Andrei Freeman (lordandrei) wrote,
Andrei Freeman
lordandrei

  • Mood:

DTD inquiry

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 </font>foo</font> element can have only one </font>bar</font> sub-element.

<!ELEMENT foo (bar+)> means that a </font>foo</font> element must have at least one </font>bar</font> sub-element, it can have more.

<!ELEMENT foo (bar*)> means that a </font>foo</font> element may have at least one </font>bar</font> sub-element, it can have more, it can have none.

now:
<!ELEMENT foo (bar, gub)> means that a </font>foo</font> element must have only one </font>bar</font> sub-element that must be followed by a </font>gub</font> sub-element.

<!ELEMENT foo (bar | gub)> means that a </font>foo</font> element must have <strong></font>either</strong></font> one </font>bar</font> sub-element or one </font>gub</font> sub-element.

So...

if my </font>foo</font> element has 3 sub elements. Call them '</font>bar</font>, </font>gub</font>, and </font>kli</font>'. 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: </font>foo</font> 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?
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments