Re: [xml] Possible xmlTextReaderRead() bug with improper XML
- From: Daniel Veillard <veillard redhat com>
- To: jwert ilstechnology com
- Cc: xml gnome org
- Subject: Re: [xml] Possible xmlTextReaderRead() bug with improper XML
- Date: Tue, 2 Jan 2007 16:50:28 -0500
On Tue, Jan 02, 2007 at 03:44:19PM -0500, jwert ilstechnology com wrote:
Hello,
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
libxml2.
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.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]