Re: [xml] xmllint schema validation reports line numbers above 65535 incorrectly (was: Re: Important: possible incompatible changes ahead for 2.9.0 !)
- From: Daniel Veillard <veillard redhat com>
- To: Johan Corveleyn <jcorvel gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] xmllint schema validation reports line numbers above 65535 incorrectly (was: Re: Important: possible incompatible changes ahead for 2.9.0 !)
- Date: Mon, 13 Aug 2012 12:54:24 +0800
On Fri, Aug 10, 2012 at 09:24:56PM +0200, Johan Corveleyn wrote:
On Fri, Aug 10, 2012 at 11:27 AM, Daniel Veillard <veillard redhat com> wrote:
On Fri, Aug 10, 2012 at 10:03:39AM +0200, Johan Corveleyn wrote:
On Fri, Aug 10, 2012 at 9:43 AM, Daniel Veillard <veillard redhat com> wrote:
[...]
That said there are ways to get "long" line numbers stored in adjacent
nodes c.f. xmlGetLineNo()
But not knowing how you actually use the parser nor how you
use the schemas validation, I cant tell if you can extract full line
numbers. It should be possible in the xmlReader for example.
But I don't know how you validate, maybe this could be added, but
I have no details from you to reproduce your specific situation so ...
Thanks for the information.
The problem I'm seeing is with schema validation of xmllint. Schema
validation errors happening after line 65535 are always reported by
xmllint as line 65535. If you'd like I can draw up a quick example, or
write a script to generate such a file and then reproduce it.
So maybe that particular problem is only in xmllint's usage of the
libraries (when doing schema validation), and maybe that can be fixed
there by accessing those long line numbers?
an instance would compress very well I assume :) send that, the schemas
and show me how you're running xmllint. XSD can be validated though a
normal tree, the reader or SAX. there might be ways to get extended line
informations in all case in a controlled environment like xmllint.
Ok, here is an example in attachment (it compressed very well indeed :-)).
The xml file has a schema validation error at line 72720 (level1
element without level2 child).
When I run:
xmllint --noout --schema test_schema.xsd test_xml.xml
I get:
test_xml.xml:65535: element level1: Schemas validity error :
Element 'level1': Missing child element(s). Expected is ( level2 ).
test_xml.xml fails to validate
Sigh ... okay, fixed for xmllint with tree support:
thinkpad:~/XML -> xmllint --noout --schema test_schema.xsd test_xml.xml
test_xml.xml:72721: element level1: Schemas validity error : Element
'level1': Missing child element(s). Expected is ( level2 ).
test_xml.xml fails to validate
thinkpad:~/XML ->
see the commit for details:
http://git.gnome.org/browse/libxml2/commit/?id=968a03a2e54f5bcf53089f5e3c8f790dbe0bf824
but that doesn't fix it for the reader or SAX mode, I would have
to investigate further
thinkpad:~/XML -> xmllint --stream --noout --schema test_schema.xsd
test_xml.xml
Schemas validity error : Element 'level1': Missing child element(s).
Expected is ( level2 ).
test_xml.xml fails to validate
thinkpad:~/XML -> xmllint --sax --noout --schema test_schema.xsd
test_xml.xmlSchemas validity error : Element 'level1': Missing child
element(s). Expected is ( level2 ).
test_xml.xml fails to validate
thinkpad:~/XML ->
Interestingly, the same problem is not present for parser errors. If
there is a parser error around that same line, the line number is
reported correctly.
yeah when parsing the parser context is given back to __xmlRaiseError
and it extracts an exact line number
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]