Re: [xml] Correct behaviour of RelaxNG interleave



On Wed, Jan 24, 2007 at 03:30:07PM +0100, Bjoern Hoehrmann wrote:
* Bjoern Hoehrmann wrote:
Your test case somewhat simplified:

 a = element a { empty }
 b = element b { empty }
 c = element c { empty }
 d = element d { empty }
 
 e = a & b
 f = c & d
 
 start = element root { e & f }

As Daniel asked, this would be

  <grammar xmlns="http://relaxng.org/ns/structure/1.0";>
    <define name="a">
      <element name="a">
        <empty/>
      </element>
    </define>
    <define name="b">
      <element name="b">
        <empty/>
      </element>
    </define>
    <define name="c">
      <element name="c">
        <empty/>
      </element>
    </define>
    <define name="d">
      <element name="d">
        <empty/>
      </element>
    </define>
    <define name="e">
      <interleave>
        <ref name="a"/>
        <ref name="b"/>
      </interleave>
    </define>
    <define name="f">
      <interleave>
        <ref name="c"/>
        <ref name="d"/>
      </interleave>
    </define>
    <start>
      <element name="root">
        <interleave>
          <ref name="e"/>
          <ref name="f"/>
        </interleave>
      </element>
    </start>
  </grammar>


  It doesn't look obvious to me that
     <root><a/><c/><b/><d/></root>
should be accepted. This is equivalent to

<element name="root">
  <interleave>
     <interleave>
       <element name="a">
         <empty/>
       </element>
       <element name="b">
         <empty/>
       </element>
     </interleave>
     <interleave>
       <element name="c">
         <empty/>
       </element>
       <element name="d">
         <empty/>
       </element>
     </interleave>
  </interleave>
</element>

I don't see the reduction rule which would be equivalent to flattening out
to a single interleave. The interleaves are at that point in a binary form,
explain because I don't see how your draw that conclusion.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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