Re: [xml] xmllint schema validation reports line numbers above 65535 incorrectly (was: Re: Important: possible incompatible changes ahead for 2.9.0 !)



On Mon, Aug 13, 2012 at 6:54 AM, Daniel Veillard <veillard redhat com> wrote:
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 ->

Great! Thanks for fixing this.

Will this be in 2.9.0, or will it have to wait for the next release?

  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 ->

Yeah, having those fixed would be nice too of course. But having
already one possible way to get validation with the correct line
numbers is very much appreciated.

-- 
Johan



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