[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] Deterministic Content Models (was DTD ( From EliotteRustHarold's Book))
- From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
- To: xml-dev <xml-dev@lists.xml.org>
- Date: Thu, 27 Sep 2001 12:23:10 -0400
At 4:50 PM +0100 9/27/01, Rob Lugt wrote:
>Our XML Validator reports non-deterministic content models as errors for
>good reason. We believe that our users want a validator to be as strict and
>as accurate as possible ~ thereby maximising the chance that their xml will
>be readable by any processor on any platform.
>
I guess the real question is how it gets reported. It is not a well-formedness error and probably should not be reported as one. On the other hand, parsers aren't required to recover from this error either so a parser is within its rights to give up here or not. Yuck.
In terms of SAX, clearly this should be reported through the error() method in the ErrorHandler class which matches this case (recoverable error) exactly. http://sax.sourceforge.net/apidoc/org/xml/sax/ErrorHandler.html#error(org.xml.sax.SAXParseException)
The next question is what to do if you've got a higher level API that's asking whether a document using a non-deterministic content model is well-formed and or valid. I think in both cases the answer must be yes, such a document is both well-formed and valid (assuming of course all the other usual rules are satisfied.) There's nothing in the XML spec to indicate that this is a violation of either well-formedness or validity. Despite this error, a document can satisfy all well-formedness and validity rules. In other words, we've uncovered a class of documents which are technically "in error" while nonetheless being well-formed and valid. Double yuck.
--
+-----------------------+------------------------+-------------------+
| 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/ |
+----------------------------------+---------------------------------+