On Thu, 21 Mar 2002 10:51:49 +0100
"Michael Wiedmann" <[EMAIL PROTECTED]> wrote:

> Hans Hagen wrote:
>  
> > How does the DTD part looks that permits the following?
> > 
> > <one> <a>...</a> <b>...</b> <c>...</c> </one>
> > <one> <b>...</b> <c>...</c> <a>...</a> </one>
> > <one> <a>...</a> </one>
> > 
> > or: arbitrary order of two optional elements b,c and one mandatory element a
> 
> <!ELEMENT one ((b,c)?,a,(b,c)?)>

You need to allow for the other optional argument as well:

<!ELEMENT one ((b|c)?,(b|c)?,a,(b|c)?,(b|c)?)>

Still not 100% correct, since this also allows "bbabb", but probably good enough.
Here is a definition that is 100% correct (although incredibly ugly)

<!ELEMENT one ((a,((b,c?)|(c,b?))?)|
               (b,((a,c?)|(c?,a)))|
               (c,((a,b?)|(b?,a)))
               )>

The big problem here is that there is no lookahead in XML. So the DTD spec has
to make sure that the parser knows what to do after every element it finds.

-- 
groeten,

Taco

Reply via email to