This is cross-posted all over the place in the vain hope that someone might have an answer:
In DTD:
<!ELEMENT foo (bar)> means that a foo element can have only one bar sub-element.
<!ELEMENT foo (bar+)> means that a foo element must have at least one bar sub-element, it can have more.
<!ELEMENT foo (bar*)> means that a foo element may have at least one bar sub-element, it can have more, it can have none.
now:
<!ELEMENT foo (bar, gub)> means that a foo element must have only one bar sub-element that must be followed by a gub sub-element.
<!ELEMENT foo (bar | gub)> means that a foo element must have <strong>either</strong> one bar sub-element or one gub sub-element.
So…
if my foo element has 3 sub elements. Call them ‘bar, gub, and kli‘. My constraints are. The sub elements must appear and must only appear once, but they can appear in any order.
You’d think:
<!ELEMENT foo (bar | gub | kli)+>
But that means: foo will have at least one sub element that could be any of the 3 choices.
I’d thought maybe:
<!ELEMENT foo ((bar) | (gub) | (kli))+>
But that seems to suffer from the previous problem.
Any takers?
« Gripe moan vent… Memetime: Where in the USA is Carmen Andreiago? »
Don’t know DTD.
But is there something like a logical AND which could allow you do to something like this:
< !ELEMENT foo (bar+)> AND < !ELEMENT foo (gub+)> AND < !ELEMENT foo (kli+)> ?
Sadly, no…
It’s not in the definition. I posted a link to a basic tutorial of DTD over in the same thread in
You say “DTD”, I say “Schema”
Not quite what you asked for, but…
Looks like DTD language is lacking
But you can still do it:
<!ELEMENT foo (
    (bar, gub, kli) |
    (bar, kli, gub) |
    (gub, kli, bar) |
    (gub, bar, kli) |
    (kli, bar, gub) |
    (kli, gub, bar)
>>