[xml] DTD validation not restrictive enough?



Hi, if I'm wrong please correct me, but...
According to http://www.w3.org/TR/REC-xml modifiers for element lists are:

[47] children ::=  (choice | seq) ('?' | '*' | '+')?
[...]
The optional character following a name or list governs whether the element or the content particles in the list may occur one or more (+), zero or more (*), or zero or one times (?). The absence of such an operator means that the element or content particle must appear exactly once. [...]

Note the last sequence - must appear exactly once...
So, for example I have following trivial xml file:
<foo>foo</foo>

And followind dtd:
<!ELEMENT foo (bar)>
<!ELEMENT bar (#PCDATA)>

I understand that <bar> element is required and not optional inside <foo>...</foo>. I use xmlValidateDtd() function and it returns status that file is ok even when <bar>...</bar> is missing in the document. Can I change some validation options to fix this behavior or it is a bug in the library?

Regards,
Jarek




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]