After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 164556 - xmlreader errors when there are only warnings
xmlreader errors when there are only warnings
Status: RESOLVED FIXED
Product: libxml
Classification: Deprecated
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2005-01-19 06:26 UTC by Sarah Wilkin
Modified: 2016-01-06 19:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Check that the result of xmlParseChunk is an error (2.30 KB, patch)
2005-01-19 06:27 UTC, Sarah Wilkin
none Details | Review

Description Sarah Wilkin 2005-01-19 06:26:06 UTC
When there is an error reported from the parser, the reader interface returns -1 on xmlTextReaderRead. 
Instead the developer should be able to handle warnings in the warning/error callback and have parsing 
continue.

With test file <test xmlns:foo=""/>
> xmllint test.xml
test.xml:1: parser warning : xmlns:foo: '' is not a valid URI
<test xmlns:foo=""/>
                  ^
<?xml version="1.0"?>
<test xmlns:foo=""/>

With example file reader1.c:
> ./reader test.xml 
test.xml:1: parser warning : xmlns:foo: '' is not a valid URI
<test xmlns:foo=""/>
                  ^
test.xml : failed to parse

What I expect is:
test.xml:1: parser warning : xmlns:foo: '' is not a valid URI
<test xmlns:foo=""/>
                  ^
0 1 test 1 0
Comment 1 Sarah Wilkin 2005-01-19 06:27:16 UTC
Created attachment 36230 [details] [review]
Check that the result of xmlParseChunk is an error
Comment 2 Daniel Veillard 2005-01-21 15:11:00 UTC
Okay, I know where the problem comes from, reproduced it and looked at
the patch. It seems to me the error is not at the xmlreader level, but
xmlParseChunk() returning non-0 even if the document is still well-formed.
The 3 first parts of your patch are a workaround, but better fixed 
in xmlParseChunk() directly which I did. That fix is in CVS now.

Regarding the other sections of your patch, removal
ofxmlTextReaderGetParserLineNumber() and xmlTextReaderGetParserColumnNumber()
are clearly bogus, you diffed agains a new version where those entries were
added. The change for xmlTextReaderHasAttributes() would similary revert a
fix introduced in CVS since.

  So fixed in CVS, thanks though the fix is different from the suggested
patch,

Daniel
Comment 3 Sarah Wilkin 2005-01-21 17:22:56 UTC
Ah, sorry the other parts of the patch shouldn't have been there. I have a few too many versions of 
libxml2 on my system :). Thanks for finding the underlying cause.
Comment 4 David Kilzer 2016-01-06 19:03:23 UTC
So this fix appears in the modern git repository as:

https://git.gnome.org/browse/libxml2/commit/?id=b8590d4c1a94b29fd55b7974ff2b77e135813c91

However, the fix appears to have been inadvertently reverted in this commit just 8 hours, 23 minutes later (since the revert is not mentioned in the ChangeLog):

https://git.gnome.org/browse/libxml2/commit/?id=1441251f851f011cd34edaff9095374d5e6f7b14

And then the test added by b8590d4c1a94b29fd55b7974ff2b77e135813c91 was removed here:

https://git.gnome.org/browse/libxml2/commit/?id=d7af555327843a9938a913205ac703c13c225603

The fourth part of the patch to parser.c from b8590d4c1a94b29fd55b7974ff2b77e135813c91 was actually re-fixed in Bug 684774:

https://git.gnome.org/browse/libxml2/commit/?id=6c91aa384f48ff6d406553a6dd47fd556c1ef2e6

However, the original three fixes that changed "(ctxt->errNo != XML_ERR_OK)" to "(ctxt->wellFormed != 1)" are still present in trunk!