[xml] xmlreader error detection



What happens when libxml, invoked via xmlreader (itself invoked via PHP's XmlReader) detects a well-formedness error? How is the error reported to the client application?

In my experiments it seems that the read method merely returns false. If that's true, is there a way to distinguish between this case and the simple end of the document?

A related question: Theoretically, the parser could report data up to the first error it finds. In my experiments with small documents, however, it actually errors out immediately. I suspect the underlying parser is preparsing a large chunk of the document, caching it, and then doling it out a piece at a time. Thus it tends to detect errors prematurely. Is this accurate?

If so, is there a limit to how much it will preparse? I assume it's not loading the whole document into a DOM first, and then iterating through that.

--
ïElliotte Rusty Harold  elharo metalab unc edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/



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