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

All > Relax NG > Simplification - mixed element > Test 150

Previous sample | Next sample

Author: James Clark
Origin: Testsuite for Relax NG


ElementsAttributes
elementname |
empty
mixed

ZVON comment: Element "foo" can have mixed content, which must contain just one element "bar".

Correct schema

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


Valid document:
<foo>x
     <bar/>
</foo>

Valid document:
<foo>
     <bar/>
</foo>

Valid document:
<foo>
     <bar/>x
</foo>

Valid document:
<foo>x
     <bar/>y
</foo>

Invalid document:
<foo/>

Invalid document:
<foo>
     <bar/>
     <bar/>
</foo>