[Home] [By Thread] [By Date] [Recent Entries]


At 4:39 PM -0500 2/22/04, John Cowan wrote:

>Poor QOI, but technically a parser can make demons fly out of your nose
>if you feed it non-XML.

That's only according to the XML spec. The SAX spec is a little more 
prescriptive, including a strict non-demon guarantee. :-) My reading 
of the SAX Javadocs says that when a parser encounters a malformed 
document, it must, at a minimum:

1. Call startDocument
2. Call fatalError
3. Call endDocument
4. Throw a SAXException or an IOException. All other kinds of 
exceptions must be wrapped in a SAXException.

It may also optionally report content from before it first detected 
the well-formedness error by calling other methods at the appropriate 
locations. However 1 through 4 are required, in that order.

1 and 3 would be skipped only if the application has not registered a 
ContentHandler. 2 would be skipped only if the application has not 
registered an ErrorHandler. Depending on the document, I've seen 
Piccolo skip each one of these, though never all four at once. 
Xerces, Crimson, and Oracle fall down on #3; though they do a pretty 
good job with 1, 2, and 4.
-- 

   Elliotte Rusty Harold
   elharo@m...
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member