OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

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

Re: [xml-dev] Deterministic Content Models (was DTD ( From EliotteRust Harold's Book))

 Let me put my language lawyer hat on and explain my thinking. The relevant section in the 2nd edition of the XML specification is 3.2.1, "For compatibility, it is an error if an element in the document can match more than one occurrence of an element type in the content model." 

However, it's not clear what kind of error this is. It's certainly not a fatal error or a well-formedness error. Is it a validity error? Well, let's look at the definition of validity:

[Definition: An XML document is valid if it has an associated document type declaration and if the document complies with the constraints expressed in it.]

I think this document is arguable valid by that definition:

<!DOCTYPE foo [
  <!ELEMENT foo (A?, A?)>

Also relevant is section 5.1:

[Definition: Validating processors must, at user option, report violations of the constraints expressed by the declarations in the DTD, and failures to fulfill the validity constraints given in this specification.]

Note the "must" in both definitions. However, the relevant sentence in section 3.2.1 is neither a validity constraint nor a constraint specified by the DTD itself. All it is is an error. Is a fully validating parser required to report it? The answer is found in the definition of error in section 1.2:

[Definition: A violation of the rules of this specification; results are undefined. Conforming software may detect and report an error and may recover from it.]

Notice the "may". This is clearly not as strong a constraint as a validity error which must be reported by a validating parser. In fact, the parser isn't even required to detect the problem, much less report, and even if does detect it, it is allowed to recover from the error. 

That's what the spec says. What does software do? Well I just tested the above case and a couple of other variants including the canonical one from Appendix E using Xerces sax.SAXCount and IE6. (Just the two parsers I had most readily at hand) Both agree that all these documents are well-formed. Xerces also thinks the document is valid. I'd be curious to see if any XML parsers do report this. 


| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      | 
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |