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?

« »