[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Deterministic Content Models (was DTD ( From EliotteRust H

  • From: Elliotte Rusty Harold <elharo@m...>
  • To: xml-dev <xml-dev@l...>
  • Date: Thu, 27 Sep 2001 11:40:58 -0400

definition of deterministic model
 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?)>
  <!ELEMENT A (#PCDATA)>
]>
<foo>
  <A>test</A>
</foo>

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@m... | 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/     |
+----------------------------------+---------------------------------+

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.