Re: [xml] Possible xmlTextReaderRead() bug with improper XML

On Tue, Jan 02, 2007 at 03:44:19PM -0500, jwert ilstechnology com wrote:

We are using the xmlreader in our application, and when parsing a char 
buffer we get an error that says:

Entity: line 1: parser error : Document is empty
  <logquery />

The problem is that the <logquery/> element has a leading 0x0C character 
(I know that's a bad thing) but what surprised me is that 
xmlTextReaderRead() threw the Document is empty error, but it still 
returned ok, and we never exit our "while(xmlTextReaderRead(reader)" loop. 
 I would have expected that to throw an error and dump me out.  If someone 
gives me a pointer where to look in the xmlreader code, I'm happy to 
investigate it, but I'm not too familiar with the inner workings of 

  Best is to provide a copy of the document leading to the problem. 
0x0C is forbidden, I don't see how this could not result in a fatal error,
and the xmlTextReaderRead() will return -1 . Note that -1 is non zero
so your loop will continue but you should only get -1 and no data will
be available from that point. xmllint --stream parses with the reader.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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