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

All > Relax NG > Simplification - number of child elements > Test 146

Previous sample | Next sample

Author: James Clark
Origin: Testsuite for Relax NG


ElementsAttributes
elementname |
empty
interleave

ZVON comment: Element "foo" must have a mixture of the elements "bar1", "bar2", and "bar3", each element must occur just once.

Correct schema

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


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

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

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

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

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

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

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

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