<!DOCTYPE testSuite [
<!ENTITY dii "<&#xE14;&#xE35;/>">
]>
<testSuite>
<author>James Clark</author>
<email>jjc@jclark.com</email>
<documentation>For October 26 version of the spec.</documentation>
<testSuite>
<section>3</section>
<testSuite>
<documentation>Various possible syntax errors.</documentation>
<testCase>
<section>3</section>
<incorrect>
<thisIsJunk/>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <element name="foo">
    <empty/>
  </element>
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <define name="bar">
    <text/>
  </define>
  <text/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <name>foo</name>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <group>
    <name>bar</name>
  </group>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <anyName>
    <except>
      <name>foo</name>
    </except>
    <except>
      <name>bar</name>
    </except>
  </anyName>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <nsName>
    <except>
      <name>foo</name>
    </except>
    <except>
      <name>bar</name>
    </except>
  </nsName>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <data type="token">
    <except>
      <value>foo</value>
    </except>
    <except>
      <value>bar</value>
    </except>
  </data>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty name="bar"/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo" extra="bar">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty>
    <empty/>
  </empty>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <text>
    <empty/>
  </text>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <choice>
    <text/>
    <notAllowed>
      <empty/>
    </notAllowed>
  </choice>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="foo">
      <empty/>
    </ref>
  </start>
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <grammar>
      <start>
        <parentRef name="foo">
          <empty/>
        </parentRef>
      </start>
    </grammar>
  </start>
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<documentation>Tests for obsolete syntax</documentation>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start name="foo">
    <element name="foo">
      <empty/>
    </element>
  </start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo" ns="http://www.example.com">
  <attribute name="bar" global="true">
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <not>
    <name>foo</name>
  </not>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <difference>
    <anyName/>
    <name>foo</name>
  </difference>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <data type="token" key="foo"/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <data type="token" keyRef="foo"/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <keyRef name="foo">
    <data type="token"/>
  </keyRef>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <key name="foo">
    <data type="token"/>
  </key>
</element>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<documentation>Tests for missing attributes and child elements</documentation>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <name>foo</name>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <group/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <interleave/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <choice/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <optional/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <oneOrMore/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <list/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <mixed/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <choice/>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <anyName>
    <except/>
  </anyName>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <nsName ns="">
    <except/>
  </nsName>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="string">
    <except/>
  </data>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="string">
    <param/>
  </data>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <grammar>
    <start/>
  </grammar>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="bar">
      <empty/>
    </element>
  </start>
  <define name="baz"/>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <externalRef/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include/>
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
  <define>
    <element name="bar">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref/>
  </start>
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <grammar>
      <start>
        <parentRef/>
      </start>
    </grammar>
  </start>
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<documentation>Checking of ns attribute</documentation>
<testCase>
<section>3</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="">
  <empty/>
</element>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<documentation>No checking of ns attribute is performed</documentation>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="DAV:">
  <empty/>
</element>
</correct>
<valid>
<foo xmlns="DAV:"/>
</valid>
</testCase>
<testCase>
<section>3</section>
<documentation>No checking of ns attribute is performed</documentation>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="xyzzy">
  <empty/>
</element>
</correct>
</testCase>
<testCase>
<section>3</section>
<documentation>No checking of ns attribute is performed</documentation>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="bad_scheme://">
  <empty/>
</element>
</correct>
</testCase>
</testSuite>
<testSuite>
<documentation>Checking of datatypeLibrary attribute</documentation>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foo_bar:xyzzy">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foobar:xyzzy">
  <empty/>
</element>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http:ok">
  <empty/>
</element>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foo:">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.example.com/%">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.example.com/%xx">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.example.com/%Aa">
  <empty/>
</element>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy#foo:bar">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy?foo:bar">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy/foo:bar">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foo:bar">
  <empty/>
</element>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
  <empty/>
</element>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data datatypeLibrary="" type="string"/>
</element>
</correct>
<valid>
<foo>x</foo>
</valid>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must not contain fragment identifier</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0"
          datatypeLibrary="http://www.example.com#xyzzy">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<documentation>Value of datatypeLibrary attribute must not contain fragment identifier</documentation>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0"
          datatypeLibrary="http://www.example.com#">
  <empty/>
</element>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<documentation>Tests for QName and NCNames in schemas</documentation>
<testCase>
<section>3</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <element name="&#xE14;&#xE35;">
    <empty/>
  </element>
</element>
</correct>
<valid>
<foo>&dii;</foo>
</valid>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="&#xE35;" xmlns="http://relaxng.org/ns/structure/1.0">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="" xmlns="http://relaxng.org/ns/structure/1.0">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <name>&#xE35;</name>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name="&#xE35;"/>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="&#xE35;"/>
  </start>
  <define name="&#xE35;">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="&#xE14;&#xE35;"/>
  </start>
  <define name="&#xE14;&#xE35;">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name=""/>
  </start>
  <define name="">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="x y"/>
  </start>
  <define name="x y">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.example.com/x">
  <start>
    <ref name="x:y"/>
  </start>
  <define name="x:y">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.example.com/x"
         name="x:&#xE35;">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.example.com/x"
         name="x:y:z">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.example.com/x"
         name="x:">
  <empty/>
</element>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<documentation>Tests for elements that allow only a single pattern child.</documentation>
<testCase>
<section>3</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="foo">
      <empty/>
    </element>
    <empty/>
  </start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <attribute name="bar">
    <text/>
    <empty/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <attribute>
    <name>bar</name>
    <text/>
    <empty/>
  </attribute>
</element>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<documentation>Tests for foreign element and attribute handling.</documentation>
<testCase>
<section>3</section>
<incorrect>
<r:element name="foo" xmlns:r="http://relaxng.org/ns/structure/1.0" r:a="val">
  <r:empty/>
</r:element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <name>foo<eg:comment xmlns:eg="http://www.example.com"/></name>
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <value>foo<eg:comment xmlns:eg="http://www.example.com"/></value>
</element>
</incorrect>
</testCase>
<testCase>
<section>3</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <data type="string"><eg:comment xmlns:eg="http://www.example.com"/></data>
</element>
</correct>
<valid>
<foo>X</foo>
</valid>
</testCase>
<testCase>
<section>3</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty>
    <ext xmlns="http://www.example.com">
      <element xmlns="http://relaxng.org/ns/structure/1.0"/>
    </ext>
  </empty>
</element>
</correct>
<valid>
<foo/>
</valid>
</testCase>
<testCase>
<section>3</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:eg="http://www.example.com">
  <eg:comment/>
  <eg:comment/>
  <start>
    <eg:comment/>
    <element>
      <eg:comment/>
      <eg:comment/>
      <name>foo</name>
      <eg:comment/>
      <data type="string"/>
      <eg:comment/>
      <empty>
        <eg:comment/>
        <eg:comment/>
      </empty>
      <eg:comment/>
      <eg:comment/>
    </element>
    <eg:comment/>
  </start>
  <eg:comment/>
</grammar>
</correct>
<valid>
<foo>X</foo>
</valid>
</testCase>
<testCase>
<section>3</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"  xmlns:eg="http://www.example.com"
  eg:comment="">
  <start eg:comment="">
    <element eg:comment="">
      <name eg:comment="">foo</name>
      <data eg:comment="" type="string"/>
      <empty eg:comment=""/>
    </element>
  </start>
</grammar>
</correct>
<valid>
<foo>X</foo>
</valid>
</testCase>
<testCase>
<section>3</section>
<correct>
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns="http://www.example.com">
  <comment/>
  <comment/>
  <rng:start>
    <comment/>
    <rng:element>
      <comment/>
      <comment/>
      <rng:name>foo</rng:name>
      <comment/>
      <rng:data type="string"/>
      <comment/>
    </rng:element>
    <comment/>
  </rng:start>
  <comment/>
</rng:grammar>
</correct>
<valid>
<foo>X</foo>
</valid>
</testCase>
<testCase>
<section>3</section>
<correct>
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
  <comment/>
  <comment/>
  <rng:start>
    <comment/>
    <rng:element>
      <comment/>
      <comment/>
      <rng:name>foo</rng:name>
      <comment/>
      <rng:data type="string"/>
      <comment/>
    </rng:element>
    <comment/>
  </rng:start>
  <comment/>
</rng:grammar>
</correct>
<valid>
<foo>X</foo>
</valid>
</testCase>
</testSuite>
</testSuite>
<testSuite>
<section>4</section>
<testSuite>
<section>4.2</section>
<testCase>
<section>4.2</section>
<correct>
<element name="&#xA;&#xD;&#x20;&#x9;foo&#xA;&#xD;&#x20;&#x9;" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name="&#xA;&#xD;&#x20;&#x9;bar&#xA;&#xD;&#x20;&#x9;"/>
</element>
</correct>
<valid>
<foo bar=""/>
</valid>
</testCase>
<testCase>
<section>4.2</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <value type="&#xA;&#xD;&#x20;&#x9;string&#xA;&#xD;&#x20;&#x9;">bar</value>
</element>
</correct>
<valid>
<foo>bar</foo>
</valid>
<invalid>
<foo>bar </foo>
</invalid>
</testCase>
<testCase>
<section>4.2</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="&#xA;&#xD;&#x20;&#x9;string&#xA;&#xD;&#x20;&#x9;"/>
</element>
</correct>
<valid>
<foo>X</foo>
</valid>
</testCase>
<testCase>
<section>4.2</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <name>&#xA;&#xD;&#x20;&#x9;foo&#xA;&#xD;&#x20;&#x9;</name>
  <attribute><name>&#xA;&#xD;&#x20;&#x9;bar&#xA;&#xD;&#x20;&#x9;</name></attribute>
</element>
</correct>
<valid>
<foo bar=""/>
</valid>
</testCase>
<testCase>
<section>4.2</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start combine="&#xA;&#xD;&#x20;&#x9;choice&#xA;&#xD;&#x20;&#x9;">
    <ref name="&#xA;&#xD;&#x20;&#x9;x&#xA;&#xD;&#x20;&#x9;"/>
  </start>
  <define name="x">
    <ref name="y"/>
  </define>
  <define name="&#xA;&#xD;&#x20;&#x9;y&#xA;&#xD;&#x20;&#x9;">
    <grammar>
      <start combine="&#xA;&#xD;&#x20;&#x9;interleave&#xA;&#xD;&#x20;&#x9;">
        <parentRef name="&#xA;&#xD;&#x20;&#x9;z&#xA;&#xD;&#x20;&#x9;"/>
      </start>
    </grammar>
  </define>
  <define name="z">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</correct>
<valid>
<foo/>
</valid>
</testCase>
</testSuite>
<testCase>
<section>4.4</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <value datatypeLibrary="http://www.example.com/this-does-not-exist">bar</value>
</element>
</correct>
<valid>
<foo>bar</foo>
</valid>
<valid>
<foo>
	bar
</foo>
</valid>
<valid>
<foo> bar </foo>
</valid>
<invalid>
<foo>baz</foo>
</invalid>
<invalid>
<foo>ba r</foo>
</invalid>
</testCase>
<testSuite>
<section>4.5</section>
<testCase>
<section>4.5</section>
<dir name="sub">
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty/>
</element>
</resource>
</dir>
<correct>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0"
             xml:base="sub/y" href="x"/>
</correct>
<valid>
<foo/>
</valid>
<invalid>
<bar/>
</invalid>
</testCase>
<testCase>
<section>4.5</section>
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="bar">
  <empty/>
</element>
</resource>
<dir name="sub1">
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="bar">
  <empty/>
</element>
</resource>
<dir name="sub3">
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty/>
</element>
</resource>
</dir>
</dir>
<correct>
<group xmlns="http://relaxng.org/ns/structure/1.0" xml:base="sub1/">
  <group>
    <group xml:base="sub2">
      <group>
         <group xml:base="sub3/y">
           <externalRef href="x"/>
         </group>
      </group>
    </group>
  </group>
</group>
</correct>
<valid>
<foo/>
</valid>
<invalid>
<bar/>
</invalid>
</testCase>
<testCase>
<section>4.5</section>
<resource name="x">
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <empty/>
</element>
</resource>
<incorrect>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x#foo"/>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<section>4.6</section>
<testCase>
<section>4.6</section>
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty/>
</element>
</resource>
<correct>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
</correct>
<valid>
<foo/>
</valid>
<invalid>
<bar/>
</invalid>
</testCase>
<testCase>
<section>4.6</section>
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty/>
</element>
</resource>
<correct>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x" ns="http://www.example.com"/>
</correct>
<valid>
<foo xmlns="http://www.example.com"/>
</valid>
<invalid>
<foo/>
</invalid>
</testCase>
<testCase>
<section>4.6</section>
<resource name="x">
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
</resource>
<incorrect>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
</incorrect>
</testCase>
<testCase>
<section>4.6</section>
<resource name="x">
<start xmlns="http://relaxng.org/ns/structure/1.0">
  <element name="foo">
    <empty/>
  </element>
</start>
</resource>
<incorrect>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
</incorrect>
</testCase>
<testCase>
<section>4.6</section>
<resource name="x">
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="y"/>
</resource>
<resource name="y">
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
</resource>
<incorrect>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
</incorrect>
</testCase>
<testCase>
<section>4.6</section>
<documentation>Same value of href before resolution, but not a loop.</documentation>
<dir name="sub">
<resource name="x">
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="sub/x"/>
</resource>
<dir name="sub">
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty/>
</element>
</resource>
</dir>
</dir>
<correct>
<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="sub/x"/>
</correct>
<valid>
<foo/>
</valid>
<invalid>
<bar/>
</invalid>
</testCase>
</testSuite>
<testSuite>
<section>4.7</section>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
</grammar>
</resource>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
</grammar>
</correct>
<valid>
<foo/>
</valid>
<invalid>
<bar/>
</invalid>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
</grammar>
</resource>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x" ns="http://www.example.com"/>
</grammar>
</correct>
<valid>
<foo xmlns="http://www.example.com"/>
</valid>
<invalid>
<foo/>
</invalid>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="y"/>
</grammar>
</resource>
<resource name="y">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
</grammar>
</resource>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
</grammar>
</correct>
<valid>
<foo/>
</valid>
<invalid>
<bar/>
</invalid>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <empty/>
</element>
</resource>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
</grammar>
</resource>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="y"/>
</grammar>
</resource>
<resource name="y">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
</grammar>
</resource>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.7</section>
<dir name="sub">
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="sub/x"/>
</grammar>
</resource>
<dir name="sub">
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
</grammar>
</resource>
</dir>
</dir>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="sub/x"/>
</grammar>
</correct>
<valid>
<foo/>
</valid>
<invalid>
<bar/>
</invalid>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</resource>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x">
    <start>
      <ref name="foo"/>
    </start>
  </include>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</resource>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
  <start>
    <ref name="foo"/>
  </start>
</grammar>
</correct>
<valid><foo/></valid>
<invalid><bar/></invalid>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="foo"/>
  </start>
</grammar>
</resource>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x">
    <define name="foo">
      <element name="foo">
        <empty/>
      </element>
    </define>
  </include>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="foo"/>
  </start>
</grammar>
</resource>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <include href="x"/>
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</grammar>
</correct>
<valid><foo/></valid>
<invalid><bar/></invalid>
</testCase>
<testCase>
<section>4.7</section>
<resource name="x">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <define name="foo" combine="choice">
    <element name="foo3">
      <empty/>
    </element>
  </define>
</grammar>
</resource>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="foo"/>
  </start>
  <include href="x">
    <define name="foo" combine="choice">
      <element name="foo1">
	<empty/>
      </element>
    </define>
  </include>
  <define name="foo">
    <element name="foo2">
      <empty/>
    </element>
  </define>
</grammar>
</correct>
<valid><foo1/></valid>
<valid><foo2/></valid>
<invalid><foo3/></invalid>
</testCase>
<testCase>
<section>4.7</section>
<resource name="level1.rng">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<include href="level2.rng">
  <define name="foo">
    <element name="bar">
      <empty/>
    </element>
  </define>
</include>
</grammar>
</resource>
<resource name="level2.rng">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <define name="bar">
    <element name="bar">
      <empty/>
    </element>
  </define>
</grammar>
</resource>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <ref name="foo"/>
</start>
<include href="level1.rng">
  <define name="foo">
    <element name="foo">
      <empty/>
    </element>
  </define>
</include>
</grammar>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<section>4.8</section>
<testCase>
<section>4.8</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.example.com" name="foo">
  <attribute name="bar" ns="http://www.example.com"/>
</element>
</correct>
<valid>
<eg:foo eg:bar="x" xmlns:eg="http://www.example.com"/>
</valid>
<invalid>
<eg:foo xmlns:eg="http://www.example.com" bar="x"/>
</invalid>
</testCase>
<testCase>
<section>4.8</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.example.com" name="foo">
  <attribute name="bar"/>
</element>
</correct>
<invalid>
<eg:foo xmlns:eg="http://www.example.com" eg:bar="x"/>
</invalid>
<valid>
<eg:foo xmlns:eg="http://www.example.com" bar="x"/>
</valid>
</testCase>
</testSuite>
<testSuite>
<section>4.9</section>
<testCase>
<section>4.9</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.example.com" name="foo">
  <attribute>
    <name>bar</name>
  </attribute>
</element>
</correct>
<valid>
<eg:foo xmlns:eg="http://www.example.com" eg:bar="x"/>
</valid>
<invalid>
<eg:foo xmlns:eg="http://www.example.com" bar="x"/>
</invalid>
</testCase>
<testCase>
<section>4.6</section>
<section>4.9</section>
<resource name="x">
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <empty/>
</element>
</resource>
<correct>
<group ns="http://www.example.com" xmlns="http://relaxng.org/ns/structure/1.0" >
<externalRef href="x"/>
</group>
</correct>
<valid>
<foo xmlns="http://www.example.com"/>
</valid>
<invalid>
<foo/>
</invalid>
</testCase>
<testCase>
<correct>
<group xmlns="http://relaxng.org/ns/structure/1.0">
  <element ns="http://www.example.com">
    <name>foo</name>
    <empty/>
  </element>
</group>
</correct>
<valid><foo xmlns="http://www.example.com"/></valid>
<invalid><foo/></invalid>
</testCase>
<testCase>
<correct>
<element ns="http://www.example.com" xmlns="http://relaxng.org/ns/structure/1.0">
  <name>foo</name>
  <empty/>
</element>
</correct>
<valid><foo xmlns="http://www.example.com"/></valid>
<invalid><foo/></invalid>
</testCase>
<testCase>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute ns="http://www.example.com">
    <name>bar</name>
    <text/>
  </attribute>
</element>
</correct>
<valid><foo xmlns:x="http://www.example.com" x:bar="whatever"/></valid>
<invalid><foo bar="whatever"/></invalid>
</testCase>
</testSuite>
<testSuite>
<section>4.10</section>
<testCase>
<section>4.10</section>
<incorrect>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo:bar">
  <empty/>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.10</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="eg:foo" xmlns:eg="http://www.example.com">
  <empty/>
</element>
</correct>
<valid>
<foo xmlns="http://www.example.com"/>
</valid>
<invalid>
<foo xmlns="http://www.example.com/"/>
</invalid>
</testCase>
<testCase>
<section>4.10</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo" xmlns:eg="http://www.example.com">
  <attribute name="eg:bar"/>
</element>
</correct>
<valid>
<foo xmlns:ex="http://www.example.com" ex:bar="x"/>
</valid>
<invalid>
<foo xmlns:ex="http://www.example.com/" ex:bar="x"/>
</invalid>
</testCase>
<testCase>
<section>4.10</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
  <attribute name="xml:lang"/>
</element>
</correct>
<valid>
<foo xml:lang="en"/>
</valid>
<invalid>
<foo lang="en"/>
</invalid>
</testCase>
</testSuite>
<testSuite>
<section>4.11</section>
<testCase>
<section>4.11</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <div ns="http://www.example.com">
    <div>
      <start>
        <ref name="foo"/>
      </start>
    </div>
    <define name="foo">
      <element name="foo">
        <empty/>
      </element>
    </define>
  </div>
  <div/>
</grammar>
</correct>
<valid>
<foo xmlns="http://www.example.com"/>
</valid>
<invalid>
<foo/>
</invalid>
</testCase>
</testSuite>
<testSuite>
<testCase>
<section>4.12</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<start>
  <element name="foo">
    <ref name="bars"/>
  </element>
</start>

<define name="bars">
  <element name="bar">
    <empty/>
  </element>
  <element name="bar">
    <empty/>
  </element>
  <element name="bar">
    <empty/>
  </element>
</define>

</grammar>
</correct>
<valid>
<foo><bar/><bar/><bar/></foo>
</valid>
<invalid>
<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/></foo>
</invalid>
<invalid>
<foo></foo>
</invalid>
<invalid>
<foo>X</foo>
</invalid>
<invalid>
<foo><bar/>X<bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/><bar/><bar/></foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <oneOrMore>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
  </oneOrMore>
</element>
</correct>
<valid>
<foo><bar/><bar/><bar/></foo>
</valid>
<valid>
<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
</valid>
<invalid>
<foo><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/></foo>
</invalid>
<invalid>
<foo></foo>
</invalid>
<invalid>
<foo>X</foo>
</invalid>
<invalid>
<foo><bar/>X<bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/><bar/><bar/></foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<section>4.15</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
  </zeroOrMore>
</element>
</correct>
<valid>
<foo><bar/><bar/><bar/></foo>
</valid>
<valid>
<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
</valid>
<invalid>
<foo><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/></foo>
</invalid>
<valid>
<foo></foo>
</valid>
<invalid>
<foo>X</foo>
</invalid>
<invalid>
<foo><bar/>X<bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/><bar/><bar/></foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<section>4.14</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <optional>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
  </optional>
</element>
</correct>
<valid>
<foo><bar/><bar/><bar/></foo>
</valid>
<invalid>
<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/></foo>
</invalid>
<valid>
<foo></foo>
</valid>
<invalid>
<foo>X</foo>
</invalid>
<invalid>
<foo><bar/>X<bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/><bar/><bar/></foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <list>
    <value>x</value>
    <value>y</value>
    <value>z</value>
  </list>
</element>
</correct>
<valid>
<foo>x y z</foo>
</valid>
<invalid>
<foo>x</foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<section>4.13</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <mixed>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
  </mixed>
</element>
</correct>
<valid>
<foo><bar/><bar/><bar/></foo>
</valid>
<invalid>
<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/></foo>
</invalid>
<invalid>
<foo></foo>
</invalid>
<valid>
<foo><bar/>X<bar/><bar/></foo>
</valid>
<invalid>
<foo>X</foo>
</invalid>
<invalid>
<foo><bar/><bar/><bar/><bar/></foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <name>foo</name>
  <element name="bar">
    <empty/>
  </element>
  <element name="bar">
    <empty/>
  </element>
  <element name="bar">
    <empty/>
  </element>
</element>
</correct>
<valid>
<foo><bar/><bar/><bar/></foo>
</valid>
<invalid>
<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/></foo>
</invalid>
<invalid>
<foo></foo>
</invalid>
<invalid>
<foo>X</foo>
</invalid>
<invalid>
<foo><bar/>X<bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/><bar/><bar/></foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0">
  <anyName>
    <except>
      <name>foo</name>
      <name>bar</name>
      <name>baz</name>
    </except>
  </anyName>
  <empty/>
</element>
</correct>
<valid><xyzzy/></valid>
<invalid><foo/></invalid>
<invalid><bar/></invalid>
<invalid><baz/></invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="token">
    <except>
      <value>x</value>
      <value>y</value>
      <value>z</value>
    </except>
  </data>
</element>
</correct>
<valid><foo/></valid>
<valid><foo>xyz</foo></valid>
<invalid><foo>x</foo></invalid>
<invalid><foo>y</foo></invalid>
<invalid><foo>y</foo></invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name="bar"/>
</element>
</correct>
<valid>
<foo bar=""/>
</valid>
<valid>
<foo bar="x"/>
</valid>
<invalid>
<foo/>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute>
    <name>bar</name>
  </attribute>
</element>
</correct>
<valid>
<foo bar=""/>
</valid>
<valid>
<foo bar="x"/>
</valid>
<invalid>
<foo/>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <group>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
    <element name="bar">
      <empty/>
    </element>
  </group>
</element>
</correct>
<valid>
<foo><bar/><bar/><bar/></foo>
</valid>
<invalid>
<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/></foo>
</invalid>
<invalid>
<foo></foo>
</invalid>
<invalid>
<foo>X</foo>
</invalid>
<invalid>
<foo><bar/>X<bar/><bar/></foo>
</invalid>
<invalid>
<foo><bar/><bar/><bar/><bar/></foo>
</invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <choice>
    <element name="bar1">
      <empty/>
    </element>
    <element name="bar2">
      <empty/>
    </element>
    <element name="bar3">
      <empty/>
    </element>
  </choice>
</element>
</correct>
<valid><foo><bar1/></foo></valid>
<valid><foo><bar2/></foo></valid>
<valid><foo><bar3/></foo></valid>
<invalid><foo/></invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" 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>
</correct>
<valid><foo><bar1/><bar2/><bar3/></foo></valid>
<valid><foo><bar1/><bar3/><bar2/></foo></valid>
<valid><foo><bar2/><bar1/><bar3/></foo></valid>
<valid><foo><bar2/><bar3/><bar1/></foo></valid>
<valid><foo><bar3/><bar1/><bar2/></foo></valid>
<valid><foo><bar3/><bar2/><bar1/></foo></valid>
<invalid><foo><bar2/><bar1/></foo></invalid>
<invalid><foo><bar1/><bar3/><bar2/><bar1/></foo></invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <group>
    <element name="bar">
      <empty/>
    </element>
  </group>
</element>
</correct>
<valid><foo><bar/></foo></valid>
<invalid><foo/></invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <interleave>
    <element name="bar">
      <empty/>
    </element>
  </interleave>
</element>
</correct>
<valid><foo><bar/></foo></valid>
<invalid><foo/></invalid>
</testCase>
<testCase>
<section>4.12</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <choice>
    <element name="bar">
      <empty/>
    </element>
  </choice>
</element>
</correct>
<valid><foo><bar/></foo></valid>
<invalid><foo/></invalid>
</testCase>
</testSuite>
<testSuite>
<section>4.13</section>
<testCase>
<section>4.13</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <mixed>
    <element name="bar">
      <empty/>
    </element>
  </mixed>
</element>
</correct>
<valid><foo>x<bar/></foo></valid>
<valid><foo><bar/></foo></valid>
<valid><foo><bar/>x</foo></valid>
<valid><foo>x<bar/>y</foo></valid>
<invalid><foo/></invalid>
<invalid><foo><bar/><bar/></foo></invalid>
</testCase>
</testSuite>
<testSuite>
<section>4.14</section>
<testCase>
<section>4.14</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <optional>
    <element name="bar">
      <empty/>
    </element>
  </optional>
</element>
</correct>
<valid><foo><bar/></foo></valid>
<valid><foo/></valid>
<invalid><foo>x<bar/></foo></invalid>
<invalid><foo><bar/><bar/></foo></invalid>
</testCase>
</testSuite>
<testSuite>
<section>4.15</section>
<testCase>
<section>4.15</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="bar">
      <empty/>
    </element>
  </zeroOrMore>
</element>
</correct>
<valid><foo><bar/></foo></valid>
<valid><foo/></valid>
<invalid><foo>x<bar/></foo></invalid>
<invalid><foo><baz/></foo></invalid>
<valid><foo><bar/><bar/></foo></valid>
</testCase>
</testSuite>
<testSuite>
<section>4.16</section>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element>
    <anyName>
      <except>
        <anyName/>
      </except>
    </anyName>
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element>
    <anyName>
      <except>
        <choice>
          <anyName/>
          <name>foo</name>
        </choice>
      </except>
    </anyName>
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element>
    <nsName ns="">
      <except>
        <nsName ns=""/>
      </except>
    </nsName>
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element>
    <nsName ns="">
      <except>
        <choice>
          <nsName ns=""/>
          <name>foo</name>
        </choice>
      </except>
    </nsName>
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element>
    <nsName ns="">
      <except>
        <anyName/>
      </except>
    </nsName>
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element>
    <nsName ns="">
      <except>
        <choice>
          <anyName/>
          <name>foo</name>
        </choice>
      </except>
    </nsName>
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<documentation>Tests that 4.16 is before 4.20.</documentation>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <zeroOrMore>
      <attribute>
	<anyName>
	  <except>
	    <anyName/>
	  </except>
	</anyName>
	<text/>
      </attribute>
      <notAllowed/>
    </zeroOrMore>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<documentation>Tests that 4.16 is before removal of unreachable definitions.</documentation>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <empty/>
  </element>
</start>
<define name="bar">
  <element>
    <anyName>
      <except>
	<anyName/>
      </except>
    </anyName>
    <empty/>
  </element>
</define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name="xmlns">
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<correct>
<element name="xmlns" xmlns="http://relaxng.org/ns/structure/1.0">
  <empty/>
</element>
</correct>
<valid><xmlns/></valid>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name=" xmlns">
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <optional>
    <notAllowed/>
    <attribute name="xmlns">
      <text/>
    </attribute>
  </optional>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="foo">
      <empty/>
    </element>
  </start>
  <define name="foo">
    <attribute name="xmlns">
      <text/>
    </attribute>
  </define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name="xmlns" ns="">
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute>
    <choice>
      <name ns="">xmlns</name>
      <name>foo</name>
    </choice>
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute>
    <name ns="">xmlns</name>
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute>
    <name>xmlns</name>
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute>
    <name>
      xmlns
    </name>
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute>
    <choice>
      <name>foo</name>
      <name ns="">xmlns</name>
    </choice>
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <oneOrMore>
    <attribute>
      <anyName>
	<except>
	  <name>xmlns</name>
	</except>
      </anyName>
      <text/>
    </attribute>
  </oneOrMore>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <oneOrMore>
    <attribute>
      <nsName ns="">
	<except>
	  <name>xmlns</name>
	</except>
      </nsName>
      <text/>
    </attribute>
  </oneOrMore>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute ns="http://www.w3.org/2000/xmlns" name="bar">
    <text/>
  </attribute>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<correct>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.w3.org/2000/xmlns">
  <empty/>
</element>
</correct>
<valid><foo xmlns="http://www.w3.org/2000/xmlns"/></valid>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="token">
    <param name="minLength">2</param>
  </data>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="tok"/>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <value type="tok"/>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <optional>
    <notAllowed/>
    <data type="token">
      <param name="minLength">2</param>
    </data>
  </optional>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <optional>
    <notAllowed/>
    <data type="tok"/>
  </optional>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
  <optional>
    <notAllowed/>
    <value type="tok"/>
  </optional>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <empty/>
  </element>
</start>
<define name="foo">
  <data type="token">
    <param name="minLength">2</param>
  </data>
</define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <empty/>
  </element>
</start>
<define name="foo">
  <data type="tok"/>
</define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.16</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <empty/>
  </element>
</start>
<define name="foo">
  <value type="tok"/>
</define>
</grammar>
</incorrect>
</testCase>
</testSuite>
<testSuite>
<section>4.17</section>
<testCase>
<section>4.17</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <ref name="x"/>
</start>
<define name="x">
  <element name="foo1">
    <empty/>
  </element>
</define>
<define name="x" combine="choice">
  <element name="foo2">
    <empty/>
  </element>
</define>
<define name="x">
  <element name="foo3">
    <empty/>
  </element>
</define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.17</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start name="x">
  <element name="foo1">
    <empty/>
  </element>
</start>
<start name="x" combine="choice">
  <element name="foo2">
    <empty/>
  </element>
</start>
<start name="x">
  <element name="foo3">
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.17</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <ref name="x"/>
</start>
<define name="x">
  <element name="foo1">
    <empty/>
  </element>
</define>
<define name="x">
  <element name="foo2">
    <empty/>
  </element>
</define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.17</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start name="x">
  <element name="foo1">
    <empty/>
  </element>
</start>
<start name="x">
  <element name="foo2">
    <empty/>
  </element>
</start>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.17</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <ref name="x"/>
</start>
<define name="x" combine="choice">
  <element name="foo1">
    <empty/>
  </element>
</define>
<define name="x" combine="choice">
  <element name="foo2">
    <empty/>
  </element>
</define>
<define name="x">
  <element name="foo3">
    <empty/>
  </element>
</define>
</grammar>
</correct>
<valid>
<foo1/>
</valid>
<valid>
<foo2/>
</valid>
<valid>
<foo3/>
</valid>
<invalid>
<foo4/>
</invalid>
</testCase>
<testCase>
<section>4.17</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start combine="choice">
  <element name="foo1">
    <empty/>
  </element>
</start>
<start combine="choice">
  <element name="foo2">
    <empty/>
  </element>
</start>
<start>
  <element name="foo3">
    <empty/>
  </element>
</start>
</grammar>
</correct>
<valid>
<foo1/>
</valid>
<valid>
<foo2/>
</valid>
<valid>
<foo3/>
</valid>
<invalid>
<foo4/>
</invalid>
</testCase>
<testCase>
<section>4.17</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <ref name="x"/>
  </element>
</start>
<define name="x" combine="choice">
  <element name="bar1">
    <empty/>
  </element>
</define>
<define name="x">
  <element name="bar2">
    <empty/>
  </element>
</define>
<define name="x" combine="interleave">
  <element name="bar3">
    <empty/>
  </element>
</define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.17</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
<grammar>
<start name="x" combine="choice">
  <element name="bar1">
    <empty/>
  </element>
</start>
<start name="x">
  <element name="bar2">
    <empty/>
  </element>
</start>
<start name="x" combine="interleave">
  <element name="bar3">
    <empty/>
  </element>
</start>
</grammar>
</element>
</incorrect>
</testCase>
<testCase>
<section>4.17</section>
<correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <ref name="x"/>
  </element>
</start>
<define name="x" combine="interleave">
  <element name="bar1">
    <empty/>
  </element>
</define>
<define name="x" combine="interleave">
  <element name="bar2">
    <empty/>
  </element>
</define>
<define name="x">
  <element name="bar3">
    <empty/>
  </element>
</define>
</grammar>
</correct>
<valid>
<foo><bar1/><bar2/><bar3/></foo>
</valid>
<valid>
<foo><bar1/><bar3/><bar2/></foo>
</valid>
<valid>
<foo><bar2/><bar3/><bar1/></foo>
</valid>
<invalid>
<foo><bar2/><bar3/><bar1/><bar2/></foo>
</invalid>
</testCase>
<testCase>
<section>4.17</section>
<correct>
<element name="foo" 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>
</correct>
<valid>
<foo><bar1/><bar2/><bar3/></foo>
</valid>
<valid>
<foo><bar1/><bar3/><bar2/></foo>
</valid>
<valid>
<foo><bar2/><bar3/><bar1/></foo>
</valid>
<invalid>
<foo><bar2/><bar3/><bar1/><bar2/></foo>
</invalid>
</testCase>
<testCase>
<section>4.17</section>
<incorrect>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
  <element name="foo">
    <ref name="x"/>
  </element>
</start>
<define name="x">
  <element name="bar1">
    <empty/>
  </element>
</define>
<define name="x" combine="interleave">
  <element name="bar2">
    <empty/>
  </element>
</define>
<define name="x">
  <element name="bar3">
    <empty/>
  </element>
</define>
</grammar>
</incorrect>
</testCase>
<testCase>
<section>4.17</section>
<incorrect>
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0"> 
<grammar>
<start name="x">
  <element name="bar1">
    <empty/>
  </element>
</start>
<start name="x" combine="interleave">
  <element name="bar2">
    <empty/>
  </element>
</start>
<start name="x">
  <element nam