ZVON > References > Zvon Example Repository
Example repository: index | categories | search

All > Relax NG > Simplification - combine attribute > Test 194

Previous sample | Next sample

Author: James Clark
Origin: Testsuite for Relax NG


ElementsAttributes
elementname |
empty
grammar
startcombine |

ZVON comment: For each grammar element, all define elements with the same name are combined together. Here the combine attribute has value "interleave", so the elements "foo1", "foo2", and "foo3" can be interleaved.

Correct schema

<element name="foo" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns="http://relaxng.org/ns/structure/1.0" >
     <grammar>
          <start combine="interleave">
               <element name="bar1">
                    <empty/>
               </element>
          </start>
          <start>
               <element name="bar2">
                    <empty/>
               </element>
          </start>
          <start combine="interleave">
               <element name="bar3">
                    <empty/>
               </element>
          </start>
     </grammar>
</element>


Valid document:
<foo>
     <bar1/>
     <bar2/>
     <bar3/>
</foo>

Valid document:
<foo>
     <bar1/>
     <bar3/>
     <bar2/>
</foo>

Valid document:
<foo>
     <bar2/>
     <bar3/>
     <bar1/>
</foo>

Invalid document:
<foo>
     <bar2/>
     <bar3/>
     <bar1/>
     <bar2/>
</foo>