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

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

Previous sample | Next sample

Author: James Clark
Origin: Testsuite for Relax NG


ElementsAttributes
attribute
elementname |
name

ZVON comment: Element "foo" must have an attribute "bar". The attribute element - which defines the "bar" attribute - does not have any children than name, so text element is added, and thus the "bar" attribute can be empty or contain a text.

Correct schema

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


Valid document:
<foo bar=""/>

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

Invalid document:
<foo/>