[xml] Possibly incomplete step 4.7 of the RELAXNG simplification process
- From: Nikolai Weibull <now disu se>
- To: xml gnome org
- Subject: [xml] Possibly incomplete step 4.7 of the RELAXNG simplification process
- Date: Fri, 07 Sep 2018 20:49:11 +0200
Hi!
I think that something is broken in the way libxml2 handles step 
4.7 of the RELAXNG simplification process.
Say that we have the following RELAXNG grammars.
a.rng:
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
 <include href="b.rng">
   <start>
     <notAllowed/>
   </start>
 </include>
 <start combine="choice">
   <element name="a">
     <empty/>
   </element>
 </start>
</grammar>
b.rng:
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
 <include href="c.rng">
   <start>
     <notAllowed/>
   </start>
 </include>
 <start combine="choice">
   <element name="b">
     <empty/>
   </element>
 </start>
</grammar>
c.rng:
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
 <start>
   <element name="c">
     <empty/>
   </element>
 </start>
</grammar>
The grammar defined in a.rng (and its included files) is accepted 
by Jing as is.  Libxml2 however, complains that
a.rng:5: element notAllowed: Relax-NG parser error : Some <start> 
element miss the combine attribute
It seems that libxml2 hasn’t, in fact, removed all start elements 
from the result of including b.rng into a.rng – and thus thinks 
that just because b.rng has a start element with a combine 
attribute, the one inside the include element in a.rng has to have 
one as well.
Removing the include from b.rng solves the problem, so my guess is 
that start elements added to the div generated from that include 
aren’t, in fact, getting removed properly when we have multiple 
levels of includes.  I am, however, not familiar with the code, so 
that’s just a guess.  I would gladly write a patch, but the code 
for this was too opaque for me to venture into.  If someone could 
point me in the right direction, I could perhaps continue.
Also of note: adding a combine attribute with “choice” to the 
start element inside the include element in a.rng makes libxml2 
accept the grammar.
 Nikolai
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]