Re: [xml] Problem with data in interleave in RELAX NG validation



On Sat, Oct 13, 2018 at 12:23:09AM +0200, Nikolai Weibull via xml wrote:
Hi!

This remains unfixed.  I have absolutely no idea what’s going on in the
interleave validation code.  Daniel, could you please put together some
minor documentation on how the interleave validation code works?  It’s very
complicated.

Thank you,

 Nikolai

  Hi Nikolai,

I must admit  I don't think I really touched that code for 10 years, it's a bit
hard :-) ... Some of the points behind the RNG implementation of libxml2
are:

  1/ I didn't used the derivation method suggested by James Clark, the problem
     is that if you want to validate an extremely large document, you end up
     building potentially an extremely large in memory derivation data
  2/ where possible, I switch the generated RNG data structure to a normal
     regexp and then use that to validate the subtree, reuses existing
     code, goes way faster due to regexp compilation, but it's certainly
     confusing when trying to understand how it all work !
  3/ based on the above I build streaming RNG validation when people want
     do do RNG validation without full in-memory tree 

so yes deciphering that code both from compilation and runtime is... hard
sorry about that :-)

There is also a known issue with validating interleaves of interleaves, I have
a mess there, it's something on the back of my mind for a decade but
surprizingly few people seems to hit it (or they just used Jing !)

Daniel

Nikolai Weibull, 2018-09-09 21:26:

Hi!

Given the following input RELAX NG grammar:

<grammar xmlns="http://relaxng.org/ns/structure/1.0";
        datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";>
 <start>
   <element name="a">
     <interleave>
       <attribute name="b"/>
       <data type="string"/>
     </interleave>
   </element>
 </start>
</grammar>

and the following input document a.xml:

<a b="1">c</a>

xmllint reports:

a.xml:1: element a: Relax-NG validity error : Element a has extra
content: text
a.xml fails to validate

Changing the interleave to a group solves the issue, so the problem is
with how interleaves are validated.

I looked at xmlRelaxNGValidateInterleave() and I sadly have no idea
what’s going on.  Please point me in the right direction and I’ll
gladly write a patch.

 Nikolai

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
https://mail.gnome.org/mailman/listinfo/xml

-- 
Daniel Veillard      | Red Hat Developers Tools http://developer.redhat.com/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/


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