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 734363 - no error column in structured error handler for xml schema validation errors
no error column in structured error handler for xml schema validation errors
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-06 14:38 UTC by jrgn.keil
Modified: 2014-08-07 03:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
xml test case, contains a schema validation error at line 3, column 9 (97 bytes, text/plain)
2014-08-06 14:40 UTC, jrgn.keil
  Details
xsd schema file for test case (640 bytes, text/plain)
2014-08-06 14:41 UTC, jrgn.keil
  Details
Test program using stream parser and validation (1.64 KB, text/plain)
2014-08-06 14:47 UTC, jrgn.keil
  Details
Proposed patch for stream mode validation (1.07 KB, patch)
2014-08-06 14:49 UTC, jrgn.keil
none Details | Review

Description jrgn.keil 2014-08-06 14:38:54 UTC
libxml2-2.9.1 or git-snapshot 2014-08-05:

When using xml schema validation, structured error callbacks do not get
passed a valid column number in xmlError field "int2".


$ ./xmlsaxparse colbug5.xml colbug5.xsd
colbug5.xml:3:0: Element '{urn:colbug5}bx': This element is not expected. Expected is ( {urn:colbug5}b ).

The schema error is reported for line 3, column 0 (= N/A).

I'd like to have the column number of the error passed in the xmlError
structure.  With this test case: line 3, column 9.
Comment 1 jrgn.keil 2014-08-06 14:40:28 UTC
Created attachment 282706 [details]
xml test case, contains a schema validation error at line 3, column 9
Comment 2 jrgn.keil 2014-08-06 14:41:02 UTC
Created attachment 282707 [details]
xsd schema file for test case
Comment 3 jrgn.keil 2014-08-06 14:47:10 UTC
Created attachment 282708 [details]
Test program using stream parser and validation

Compile and run like this:

$ cc `xml2-config --cflags --libs` -o xmlsaxparse xmlsaxparse.c

$ ./xmlsaxparse colbug5.xml colbug5.xsd
colbug5.xml:3:0: Element '{urn:colbug5}bx': This element is not expected. Expected is ( {urn:colbug5}b ).

schema validation error 1871


Expected output is "colbug5.xml:3:9:..."
instead of "colbug5.xml:3:0:..."
Comment 4 jrgn.keil 2014-08-06 14:49:58 UTC
Created attachment 282710 [details] [review]
Proposed patch for stream mode validation
Comment 5 Daniel Veillard 2014-08-07 03:43:57 UTC
Yes that looks fine, applied and commited as git commit
d201e71ed0df1dce7aca232f81a1c3e2eee8be73

  thanks !

Daniel