<?xml version="1.0" encoding="utf-8"?>
<!-- IE chokes on this <!DOCTYPE testSuite
[
<!ENTITY dii "<&#xE14;&#xE35;/>">
]>-->
<testSuite xmlns="">

  <testSuite>
    <title>RelaxNG Schemas</title>
    <documentation>RelaxNG Schemas for various documents types.</documentation>
    
		<testSuite>
		  <title>XHTML</title>
      <documentation>XHTML Schemas</documentation>
      
      <testCase>
      	<title>XHTML Basic</title>
				<documentation>Basic XHTML</documentation>
      	<correct file="../lib/xhtml/xhtml-basic.rng"/>
      	<valid>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>TITLE</title>
	</head>
	<body>
		<p>PARAGRAPH</p>
	</body>
</html>
      	</valid>
      	<valid>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>TITLE</title>
	</head>
	<body>
		<p>PARAGRAPH<a href="">LINK</a></p>
	</body>
</html>
      	</valid>
      	<valid file="../lib/xhtml/index.html"/>
      	<invalid>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>TITLE</title>
	</head>
	<body>
		<p>PARAGRAPH<a href="" invalid="">LINK</a></p>
	</body>
</html>
      	</invalid>
      </testCase>
      
      <testCase>
      	<title>XHTML Strict</title>
				<documentation>Strict XHTML</documentation>
      	<correct file="../lib/xhtml/xhtml-strict.rng"/>
      	<valid file="../lib/xhtml/index.html"/>
      </testCase>
      
      <testCase>
      	<title>XHTML Frames</title>
				<documentation>Transitional XHTML and framesets</documentation>
      	<correct file="../lib/xhtml/xhtml.rng"/>
      	<valid>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<title>Frames</title>
	</head>
	<frameset>
		<frame/>
		<noframes>
			<body>
				<p>PARAGRAPH<a href="">LINK</a></p>
			</body>
		</noframes>
	</frameset>
</html>
				</valid>
      </testCase>
      
    </testSuite>
    
		<!--
		<testSuite>
		  <title>DocBook</title>
      <documentation>DocBook Schemas</documentation>
      
      <testCase>
      	<title>DocBook 5.0b1</title>
				<documentation>RNG Schema for DocBook, version 5.0b1</documentation>
      	<correct file="../lib/docbook/docbook.rng"/>
      </testCase>
    
    </testSuite>

		<testSuite>
		  <title>MathML2</title>
      <documentation>MathML2 Schemas</documentation>
      
      <testCase>
      	<title>MathML2</title>
				<documentation>RNG Schema for MathML2</documentation>
      	<correct file="../lib/mml2/mathml2.rng"/>
      </testCase>
    
    </testSuite>
    -->
    
  </testSuite>

  <testSuite>
    <title>Tutorial Test Suite</title>
    <author>James Overton</author>
    <email>james@overton.ca</email>
    <documentation>Mozile RNG validation test suite.</documentation>

		<testSuite>
		  <title>Getting Started</title>
		  <section>1</section>
      <documentation>RelaxNG basics.</documentation>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <element name="name">
        <text/>
      </element>
      <element name="email">
        <text/>
      </element>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
  </card>
</addressBook>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <oneOrMore>
    <element name="card">
      <element name="name">
        <text/>
      </element>
      <element name="email">
        <text/>
      </element>
    </element>
  </oneOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
  </card>
</addressBook>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <element name="name">
        <text/>
      </element>
      <element name="email">
        <text/>
      </element>
      <optional>
	<element name="note">
	  <text/>
	</element>
      </optional>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
    <note>This is a note.</note>
  </card>
</addressBook>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<rng:element name="addressBook" xmlns:rng="http://relaxng.org/ns/structure/1.0">
  <rng:zeroOrMore>
    <rng:element name="card">
      <rng:element name="name">
        <rng:text/>
      </rng:element>
      <rng:element name="email">
        <rng:text/>
      </rng:element>
    </rng:element>
  </rng:zeroOrMore>
</rng:element>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
  </card>
</addressBook>
			 </valid>
			</testCase>

		</testSuite>

		<testSuite>
		  <title>Choice</title>
		  <section>2</section>
      <documentation>Alternative patterns.</documentation>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <choice>
        <element name="name">
          <text/>
        </element>
        <group>
          <element name="givenName">
            <text/>
          </element>
          <element name="familyName">
            <text/>
          </element>
        </group>
      </choice>
      <element name="email">
        <text/>
      </element>
      <optional>
			<element name="note">
				<text/>
			</element>
      </optional>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <givenName>John</givenName>
    <familyName>Smith</familyName>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
  </card>
</addressBook>
			 </valid>
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Attributes</title>
		  <section>3</section>
      <documentation>Validating attributes.</documentation>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <attribute name="name">
        <text/>
      </attribute>
      <attribute name="email">
        <text/>
      </attribute>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
	<card name="John Smith" email="js@example.com"/>
</addressBook>
			 </valid>
			 <valid>
<addressBook>
	<card email="js@example.com" name="John Smith"/>
</addressBook>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <attribute name="name">
        <text/>
      </attribute>
      <attribute name="email">
        <text/>
      </attribute>
      <optional>
        <attribute name="note">
          <text/>
        </attribute>
      </optional>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
	<card name="John Smith" email="js@example.com"/>
	<card name="Fred Bloggs" email="fb@example.net" note="This is a note"/>
</addressBook>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <choice>
        <attribute name="name">
          <text/>
        </attribute>
        <group>
          <attribute name="givenName">
            <text/>
          </attribute>
          <attribute name="familyName">
            <text/>
          </attribute>
        </group>
      </choice>
      <attribute name="email">
        <text/>
      </attribute>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
	<card givenName="John" familyName="Smith" email="js@example.com"/>
	<card name="Fred Bloggs" email="fb@example.net"/>
</addressBook>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <choice>
				<element name="name">
					<text/>
				</element>
				<attribute name="name">
					<text/>
				</attribute>
      </choice>
      <choice>
				<element name="email">
					<text/>
				</element>
				<attribute name="email">
					<text/>
				</attribute>
      </choice>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
	<card name="John Smith" email="js@example.com"/>
	<card email="js@example.com" name="John Smith"/>
	<card email="js@example.com"><name>John Smith</name></card>
	<card name="John Smith"><email>js@example.com</email></card>
	<card><name>John Smith</name><email>js@example.com</email></card>
</addressBook>
			 </valid>
			 <invalid>
<addressBook>
	<card><email>js@example.com</email><name>John Smith</name></card>
</addressBook>
			 </invalid>
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Named Patterns</title>
		  <section>4</section>
      <documentation>Grammars, definitions, and references.</documentation>

			<testCase>
			 <correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

  <start>
    <element name="addressBook">
      <zeroOrMore>
	<element name="card">
	  <ref name="cardContent"/>
	</element>
      </zeroOrMore>
    </element>
  </start>

  <define name="cardContent">
    <element name="name">
      <text/>
    </element>
    <element name="email">
      <text/>
    </element>
  </define>

</grammar>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
  </card>
</addressBook>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

  <start>
    <ref name="AddressBook"/>
  </start>

  <define name="AddressBook">
    <element name="addressBook">
      <zeroOrMore>
        <ref name="Card"/>
      </zeroOrMore>
    </element>
  </define>

  <define name="Card">
    <element name="card">
      <ref name="Name"/>
      <ref name="Email"/>
    </element>
  </define>

  <define name="Name">
    <element name="name">
      <text/>
    </element>
  </define>

  <define name="Email">
    <element name="email">
      <text/>
    </element>
  </define>

</grammar>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
  </card>
</addressBook>
			 </valid>
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Datatyping</title>
		  <section>5</section>
      <documentation>Validating element and attribute values against datatypes.</documentation>

			<testCase>
			 <correct>
<element name="number" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="integer" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"/>
</element>
			 </correct>
			 <valid>
<number>1</number>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="point" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0">
  <element name="x">
    <data type="double"/>
  </element>
  <element name="y">
    <data type="double"/>
  </element>
</element>
			 </correct>
			 <valid>
<point>
	<x>1.0</x>
	<y>2.0</y>
</point>
			 </valid>
			</testCase>

			<testCase>
			 <incorrect>
<element name="bad" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="int"/>
  <element name="note">
    <text/>
  </element>
</element>
			 </incorrect>
			</testCase>

			<testCase>
			 <correct>
<element name="ok" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="int"/>
  <attribute name="note">
    <text/>
  </attribute>
</element>
			 </correct>
			 <valid>
<ok note="This is a note">1</ok>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="email" xmlns="http://relaxng.org/ns/structure/1.0">
  <data type="string">
    <param name="maxLength">127</param>
  </data>
</element>
			 </correct>
			 <valid>
<email>short</email>
			 </valid>
			 <invalid>
<email>long string: Datatypes may have parameters. For example, a string datatype may have a parameter controlling the length of the string. The parameters applicable to any particular datatype are determined by the datatyping vocabulary. Parameters are specified by adding one or more param elements as children of the data element. For example, the following constrains the email element to contain a string at most 127 characters long.</email>
			 </invalid>
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Enumerations</title>
		  <section>6</section>
      <documentation>Sets of possible values for an element or attribute.</documentation>

			<testCase>
			 <correct>
<element name="card" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name="name"/>
  <attribute name="email"/>
  <attribute name="preferredFormat">
    <choice>
      <value>html</value>
      <value>text</value>
    </choice>
  </attribute>
</element>
			 </correct>
			 <valid>
<card name="John Smith" email="js@example.com" preferredFormat="text"/>
			 </valid>
			 <valid>
<card name="John Smith" email="js@example.com" preferredFormat="html"/>
			 </valid>
			 <valid>
<card name="John Smith" email="js@example.com" preferredFormat="    html    "/>
			 </valid>
			 <invalid>
<card name="John Smith" email="js@example.com" preferredFormat="other"/>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<element name="card" xmlns="http://relaxng.org/ns/structure/1.0">
  <element name="name">
    <text/>
  </element>
  <element name="email">
    <text/>
  </element>
  <element name="preferredFormat">
    <choice>
      <value>html</value>
      <value>text</value>
    </choice>
  </element>
</element>
			 </correct>
			 <valid>
<card>
	<name>John Smith</name>
	<email>js@example.com</email>
	<preferredFormat>text</preferredFormat>
</card>
			 </valid>
			 <valid>
<card>
	<name>John Smith</name>
	<email>js@example.com</email>
	<preferredFormat>html</preferredFormat>
</card>
			 </valid>
			 <invalid>
<card>
	<name>John Smith</name>
	<email>js@example.com</email>
	<preferredFormat>other</preferredFormat>
</card>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<element name="card" xmlns="http://relaxng.org/ns/structure/1.0">
  <attribute name="name"/>
  <attribute name="email"/>
  <attribute name="preferredFormat">
    <choice>
      <value type="string">html</value>
      <value type="string">text</value>
    </choice>
  </attribute>
</element>
			 </correct>
			 <valid>
<card name="John Smith" email="js@example.com" preferredFormat="html"/>
			 </valid>
			 <invalid>
<card name="John Smith" email="js@example.com" preferredFormat="    html    "/>
			 </invalid>
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Lists</title>
		  <section>7</section>
      <documentation>Whitespace separated sequences.</documentation>

			<testCase>
			 <correct>
<element name="vector" xmlns="http://relaxng.org/ns/structure/1.0">
  <list>
    <data type="float"/>
    <data type="float"/>
  </list>
</element>
			 </correct>
			 <valid>
<vector>1 2</vector>
			 </valid>
			 <invalid>
<vector></vector>
			 </invalid>
			 <invalid>
<vector>1 a 3</vector>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<element name="vector" xmlns="http://relaxng.org/ns/structure/1.0">
  <list>
    <oneOrMore>
      <data type="double"/>
    </oneOrMore>
  </list>
</element>
			 </correct>
			 <valid>
<vector>1 2</vector>
			 </valid>
			 <valid>
<vector>1 2 3 4 5 6 7</vector>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="path" xmlns="http://relaxng.org/ns/structure/1.0">
  <list>
    <oneOrMore>
      <data type="double"/>
      <data type="double"/>
    </oneOrMore>
  </list>
</element>
			 </correct>
			 <valid>
<path>1 2 3 4 5 6</path>
			 </valid>
			 <invalid>
<path>1 2 3 4 5 6 7</path>
			 </invalid>
			</testCase>

		</testSuite>
		

		<testSuite>
		  <title>Interleaving</title>
		  <section>8</section>
      <documentation>Allow elements in any order.</documentation>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <interleave>
	<element name="name">
	  <text/>
	</element>
	<element name="email">
	  <text/>
	</element>
      </interleave>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <email>fb@example.net</email>
    <name>Fred Bloggs</name>
  </card>
</addressBook>
			 </valid>
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Modularity</title>
		  <section>9</section>
      <documentation>Referencing and combining grammars</documentation>


		</testSuite>


		<testSuite>
		  <title>Namespaces</title>
		  <section>10</section>
      <documentation>Namespace support.</documentation>

			<testCase>
			 <correct>
<element name="foo" ns="http://www.example.com" xmlns="http://relaxng.org/ns/structure/1.0">
  <empty/>
</element>
			 </correct>
			 <valid>
<foo xmlns="http://www.example.com"/>
			 </valid>
			 <valid>
<e:foo xmlns:e="http://www.example.com"/>
			 </valid>
			 <valid>
<example:foo xmlns:example="http://www.example.com"/>
			 </valid>
			 <invalid>
<foo/>
			 </invalid>
			 <invalid>
<e:foo xmlns:e="http://WWW.EXAMPLE.COM"/>
			 </invalid>
			 <invalid>
<example:foo xmlns:example="http://www.example.net"/>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<element name="foo" ns="" xmlns="http://relaxng.org/ns/structure/1.0">
  <empty/>
</element>
			 </correct>
			 <valid>
<foo xmlns=""/>
			 </valid>
			 <valid>
<foo/>
			 </valid>
			 <invalid>
<foo xmlns="http://www.example.com"/>
			 </invalid>
			 <invalid>
<e:foo xmlns:e="http://www.example.com"/>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<element name="addressBook" ns="http://www.example.com" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="card">
      <attribute name="name"/>
      <attribute name="email"/>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook xmlns="http://www.example.com">
  <card name="John Smith" email="js@example.com"/>
</addressBook>
			 </valid>
			 <valid>
<example:addressBook xmlns:example="http://www.example.com">
  <example:card name="John Smith" email="js@example.com"/>
</example:addressBook>
			 </valid>
			 <invalid>
<example:addressBook xmlns:example="http://www.example.com">
  <example:card example:name="John Smith" example:email="js@example.com"/>
</example:addressBook>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<element name="ab:addressBook" xmlns:ab="http://www.example.com/addressBook"
                               xmlns:a="http://www.example.com/address" 
                               xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <element name="ab:card">
      <element name="a:name">
        <text/>
      </element>
      <element name="a:email">
        <text/>
      </element>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<ab:addressBook xmlns:ab="http://www.example.com/addressBook"
             xmlns:a="http://www.example.com/address">
  <ab:card>
    <a:name>John Smith</a:name>
    <a:email>js@example.com</a:email>
  </ab:card>
  <ab:card>
    <a:email>fb@example.net</a:email>
    <a:name>Fred Bloggs</a:name>
  </ab:card>
</ab:addressBook>
			 </valid>
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Name Classes</title>
		  <section>11</section>
      <documentation>Describing a class of names for an element or attribute to match.</documentation>

			<testCase>
			 <correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

  <start>
    <ref name="anyElement"/>
  </start>

  <define name="anyElement">
    <element>
      <anyName/>
      <zeroOrMore>
				<choice>
					<attribute>
						<anyName/>
					</attribute>
					<text/>
					<ref name="anyElement"/>
				</choice>
      </zeroOrMore>
    </element>
  </define>

</grammar>
			 </correct>
			 <valid>
<a b="B" c="C">A</a>
			 </valid>
			</testCase>

			<testCase>
			 <correct>
<element name="card" ns="http://www.example.com" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <attribute>
      <anyName>
        <except>
          <nsName/>
          <nsName ns=""/>
        </except>
      </anyName>
    </attribute>
  </zeroOrMore>
  <text/>
</element>
			 </correct>
			 <valid>
<card xmlns="http://www.example.com" xmlns:a="NS-A" a:b="B" a:c="C"/>
			 </valid>
			 <invalid>
<card xmlns="http://www.example.com" b="B" c="C"/>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<element name="example" xmlns="http://relaxng.org/ns/structure/1.0">
  <zeroOrMore>
    <attribute>
      <anyName>
        <except>
          <name>xml:space</name>
        </except>
      </anyName>
    </attribute>
  </zeroOrMore>
  <optional>
    <attribute name="xml:space">
      <choice>
        <value>default</value>
        <value>preserve</value>
      </choice>
    </attribute>
  </optional>
</element>
			 </correct>
			 <valid>
<example a="A"/>
			 </valid>
			 <valid>
<example a="A" xml:space="default"/>
			 </valid>
			 <valid>
<example a="A" xml:space="preserve"/>
			 </valid>
			 <!--
			 <invalid>
<example a="A" xml:space="other"/>
			 </invalid>
			 -->
			</testCase>

		</testSuite>


		<testSuite>
		  <title>Annotations</title>
		  <section>12</section>
      <documentation>Elements with other namespaces are ignored in an RNG schema.</documentation>

			<testCase>
			 <correct>
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:a="http://www.example.com/annotation">
  <zeroOrMore>
    <element name="card">
      <a:documentation>Information about a single email address.</a:documentation>
      <element name="name">
        <text/>
      </element>
      <element name="email">
        <text/>
      </element>
    </element>
  </zeroOrMore>
</element>
			 </correct>
			 <valid>
<addressBook>
  <card>
    <name>John Smith</name>
    <email>js@example.com</email>
  </card>
  <card>
    <name>Fred Bloggs</name>
    <email>fb@example.net</email>
  </card>
</addressBook>
			 </valid>
			</testCase>

		</testSuite>

    <!--

			<testCase>
			 <correct>

			 </correct>
			 <valid>

			 </valid>
			</testCase>

		<testSuite>
		  <title></title>
		  <section>1</section>
      <documentation>Various possible syntax errors.</documentation>

			<testCase>
			 <correct>

			 </correct>
			 <valid>

			 </valid>
			</testCase>

		</testSuite>
		-->
    
  </testSuite>




  <testSuite>
    <title>Mozile Test Suite</title>
    <author>James Overton</author>
    <email>james@overton.ca</email>
    <documentation>Mozile RNG validation test suite.</documentation>

		<testSuite id="mozile.rng.Grammar">
		  <title>Grammar</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Grammar object.</documentation>
			<testCase>
			 <correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <element name="a"><empty/></element> </start> </grammar>
			 </correct>
			 <valid>
<a/>
			 </valid>
			 <valid>
<a></a>
			 </valid>
			 <valid>
<a> </a>
			 </valid>
			 <invalid>
<b/>
			 </invalid>
			 <invalid>
<b></b>
			 </invalid>
			 <invalid>
<b> </b>
			 </invalid>
			 <invalid>
<a><b/></a>
			 </invalid>
			 <invalid>
<a> <b/></a>
			 </invalid>
			</testCase>

			<testCase>
			 <correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <ref name="D"/> </start> <define name="D"> <element name="a"><empty/></element> </define> </grammar>
			 </correct>
			 <valid>
<a/>
			 </valid>
			 <valid>
<a></a>
			 </valid>
			 <valid>
<a> </a>
			 </valid>
			 <invalid>
<b/>
			 </invalid>
			 <invalid>
<b></b>
			 </invalid>
			 <invalid>
<b> </b>
			 </invalid>
			 <invalid>
<a><b/></a>
			 </invalid>
			 <invalid>
<a> <b/></a>
			 </invalid>
			</testCase>
		</testSuite>


		<testSuite id="mozile.rng.Start">
		  <title>Start</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Start object.</documentation>
			<testCase>
			 <correct>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <element name="a"><empty/></element> </start> </grammar>
			 </correct>
			 <valid>
<a/>
			 </valid>
			 <valid>
<a></a>
			 </valid>
			 <valid>
<a> </a>
			 </valid>
			 <invalid>
<b/>
			 </invalid>
			 <invalid>
<b></b>
			 </invalid>
			 <invalid>
<b> </b>
			 </invalid>
			 <invalid>
<a><b/></a>
			 </invalid>
			 <invalid>
<a> <b/></a>
			 </invalid>
			</testCase>
		</testSuite>


		<testSuite id="mozile.rng.Element">
		  <title>Element</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Element object.</documentation>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"><empty/></element></correct>

	<valid><a/></valid>
	<valid><a></a></valid>
	<valid><a> </a></valid>

	<invalid><b/></invalid>
	<invalid><b></b></invalid>
	<invalid><b> </b></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a> <b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="b"><empty/></element> </element></correct>

	<valid><a><b/></a></valid>
	<valid><a> <b/> </a></valid>

	<invalid><a/></invalid>
	<invalid><a></a></invalid>
	<invalid><a> </a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/> </a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a> <b/> <c/> </a></invalid>
	<invalid><a><b><c/></b></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="b"><empty/></element> <element name="c"><empty/></element> </element></correct>

	<valid><a><b/><c/></a></valid>
	<valid><a> <b/> <c/> </a></valid>

	<invalid><a/></invalid>
	<invalid><a></a></invalid>
	<invalid><a> </a></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a> <c/></a></invalid>
	<invalid><a><c/> </a></invalid>
	<invalid><a><c/><b/></a></invalid>
	<invalid><a><b><c/></b></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <text/> </element></correct>

	<valid><a/></valid>
	<valid><a></a></valid>
	<valid><a> </a></valid>
	<valid><a>text</a></valid>

	<invalid><b/></invalid>
	<invalid><b>text</b></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a>text<b/></a></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a>text<b/>text</a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <text/> <element name="b"><empty/></element> </element></correct>

	<valid><a><b/></a></valid>
	<valid><a><b></b></a></valid>
	<valid><a> <b> </b> </a></valid>
	<valid><a>text<b/></a></valid>
	<valid><a>text<b> </b></a></valid>
	<valid><a><b/>text</a></valid>
	<valid><a>text<b/>text</a></valid>
	<valid><a>text<b> </b>text</a></valid>

	<invalid><a/></invalid>
	<invalid><a> </a></invalid>
	<invalid><a>text</a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/>text</a></invalid>
	<invalid><a><b>text</b></a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a><b/>text<c/></a></invalid>
	<invalid><a><b>text</b></a></invalid>
	<invalid><a><b><c/></b></a></invalid>
	<invalid><a><b><c/>text</b></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <element name="b"><empty/></element> <text/> </element></correct>

	<valid><a><b/></a></valid>
	<valid><a><b></b></a></valid>
	<valid><a> <b> </b> </a></valid>
	<valid><a>text<b/></a></valid>
	<valid><a>text<b> </b></a></valid>
	<valid><a><b/>text</a></valid>
	<valid><a>text<b/>text</a></valid>
	<valid><a>text<b> </b>text</a></valid>

	<invalid><a/></invalid>
	<invalid><a> </a></invalid>
	<invalid><a>text</a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/>text</a></invalid>
	<invalid><a><b>text</b></a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a><b/>text<c/></a></invalid>
	<invalid><a><b>text</b></a></invalid>
	<invalid><a><b><c/></b></a></invalid>
	<invalid><a><b><c/>text</b></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0" ns="NS1" xmlns:x="NS2"> <element name="b" ns="NS2"><empty/></element> <element name="x:c"><empty/></element> </element></correct>

	<valid><a xmlns="NS1"> <b xmlns="NS2"/> <c xmlns="NS2"/> </a></valid>
	<valid><a xmlns="NS1" xmlns:n="NS2"> <n:b/> <n:c/> </a></valid>
	<valid><n:a xmlns:n="NS1"> <b xmlns="NS2"/> <c xmlns="NS2"/> </n:a></valid>
	<valid><m:a xmlns:m="NS1" xmlns:n="NS2"> <n:b/> <n:c/> </m:a></valid>

	<invalid><a><b/><c/></a></invalid>
	<invalid><a xmlns="NS2"> <b xmlns="NS2"/> <c xmlns="NS2"/> </a></invalid>
	<invalid><a xmlns="NS1"> <b xmlns="NS1"/> <c xmlns="NS2"/> </a></invalid>
	<invalid><a xmlns="NS1"> <b xmlns="NS2"/> <c xmlns="NS1"/> </a></invalid>
	<invalid><a xmlns="NS1" xmlns:n="NS2"> <b/> <n:c/> </a></invalid>
	<invalid><a xmlns="NS1" xmlns:n="NS2"> <n:b/> <c/> </a></invalid>

</testCase>

		</testSuite>

		<testSuite id="mozile.rng.Attribute">
		  <title>Attribute</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Attribute object.</documentation>
<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"><attribute name="b"/></element></correct>

	<valid><a b=""/></valid>
	<valid><a b="text"/></valid>

	<invalid><a/></invalid>
	<invalid><a c=""/></invalid>
	<invalid><a b="" c=""/></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0" ns="NS1" xmlns:x="NS2"> <attribute name="b" ns="NS2"/> <attribute name="x:c"/> </element></correct>

	<valid><a xmlns="NS1" xmlns:n="NS2" n:b="" n:c=""/></valid>
	<valid><n:a xmlns:n="NS1" xmlns:m="NS2" m:b="" m:c=""/></valid>

	<invalid><a/></invalid>
	<!--<invalid><a xmlns="NS1"/></invalid> Chokes IE -->
	<invalid><a xmlns="NS1" xmlns:n="NS2" n:c=""/></invalid>
	<invalid><a xmlns="NS1" xmlns:n="NS2" n:b=""/></invalid>
	<invalid><a xmlns="NS1" xmlns:n="NS2" b="" n:c=""/></invalid>
	<invalid><a xmlns="NS1" xmlns:n="NS2" n:b="" c=""/></invalid>
	<invalid><a xmlns="NS1" xmlns:n="NS2" n:c=""/></invalid>
	<invalid><a xmlns="NS1" xmlns:n="NS2" n:b=""/></invalid>
	<invalid><m:a xmlns:n="NS1" xmlns:m="NS2" m:b="" m:c=""/></invalid>
	<invalid><n:a xmlns:n="NS1" xmlns:m="NS2" n:b="" m:c=""/></invalid>
	<invalid><n:a xmlns:n="NS1" xmlns:m="NS2" m:b="" n:c=""/></invalid>

</testCase>
		</testSuite>


		<testSuite id="mozile.rng.Group">
		  <title>Group</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Group object.</documentation>
<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <group> <text/> <element name="b"><empty/></element> <element name="c"><empty/></element> </group> </element></correct>

	<valid><a><b/><c/></a></valid>
	<valid><a> <b/> <c/> </a></valid>
	<valid><a> <b/>text<c/> </a></valid>

	<invalid><b/></invalid>
	<invalid><a> <b/> </a></invalid>
	<invalid><a> <c/> </a></invalid>
	<invalid><a> <c/> <b/> </a></invalid>

</testCase>
		</testSuite>


		<testSuite id="mozile.rng.Optional">
		  <title>Optional</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Optional object.</documentation>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <optional> <element name="b"><empty/></element> </optional> </element></correct>

	<valid><a/></valid>
	<valid><a><b/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <optional> <attribute name="b"/> </optional> </element></correct>

	<valid><a/></valid>
	<valid><a b=""/></valid>

	<invalid><b/></invalid>
	<invalid><a c=""/></invalid>
	<invalid><a b="" c=""/></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <optional> <element name="b"><empty/></element> <element name="c"><empty/></element> </optional> </element></correct>

	<valid><a/></valid>
	<valid><a><b/><c/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <optional> <element name="b"><empty/></element> </optional> <element name="c"><empty/></element> </element></correct>

	<valid><a><c/></a></valid>
	<valid><a><b/><c/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>


		</testSuite>


		<testSuite id="mozile.rng.ZeroOrMore">
		  <title>ZeroOrMore</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG ZeroOrMore object.</documentation>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <zeroOrMore> <element name="b"><empty/></element> </zeroOrMore> </element></correct>

	<valid><a/></valid>
	<valid><a><b/></a></valid>
	<valid><a><b/><b/></a></valid>
	<valid><a><b/><b/><b/></a></valid>
	<valid><a><b/><b/><b/><b/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <zeroOrMore> <element name="b"><empty/></element> <element name="c"><empty/></element> </zeroOrMore> </element></correct>

	<valid><a/></valid>
	<valid><a><b/><c/></a></valid>
	<valid><a><b/><c/><b/><c/></a></valid>
	<valid><a><b/><c/><b/><c/><b/><c/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <zeroOrMore> <element name="b"><empty/></element> </zeroOrMore> <element name="c"><empty/></element> </element></correct>

	<valid><a><c/></a></valid>
	<valid><a><b/><c/></a></valid>
	<valid><a><b/><b/><c/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>
		</testSuite>


		<testSuite id="mozile.rng.OneOrMore">
		  <title>OneOrMore</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG OneOrMore object.</documentation>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <oneOrMore> <element name="b"><empty/></element> </oneOrMore> </element></correct>

	<valid><a><b/></a></valid>
	<valid><a><b/><b/></a></valid>
	<valid><a><b/><b/><b/></a></valid>
	<valid><a><b/><b/><b/><b/></a></valid>

	<invalid><a/></invalid>
	<invalid><b/></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <oneOrMore> <element name="b"><empty/></element> <element name="c"><empty/></element> </oneOrMore> </element></correct>

	<valid><a><b/><c/></a></valid>
	<valid><a><b/><c/><b/><c/></a></valid>
	<valid><a><b/><c/><b/><c/><b/><c/></a></valid>

	<invalid><a/></invalid>
	<invalid><b/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <oneOrMore> <element name="b"><empty/></element> </oneOrMore> <element name="c"><empty/></element> </element></correct>

	<valid><a><b/><c/></a></valid>
	<valid><a><b/><b/><c/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>
		</testSuite>


		<testSuite id="mozile.rng.Choice">
		  <title>Choice</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Choice object.</documentation>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> <element name="b"><empty/></element> <element name="c"><empty/></element> </choice> </element></correct>

	<valid><a><b/></a></valid>
	<valid><a><c/></a></valid>

	<invalid><a/></invalid>
	<invalid><b/></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> <text/> <element name="b"><empty/></element> </choice> </element></correct>

	<valid><a/></valid>
	<valid><a>text</a></valid>
	<valid><a><b/></a></valid>
	<valid><a><b/>text</a></valid>

	<invalid><b/></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/>text</a></invalid>
	<invalid><a><b/>text<b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> <attribute name="b"/> <attribute name="c"/> </choice> </element></correct>

	<valid><a b=""/></valid>
	<valid><a c=""/></valid>

	<invalid><a/></invalid>
	<invalid><b/></invalid>
	<invalid><a d=""/></invalid>
	<invalid><a b="" c=""/></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <choice> <group> <element name="b"><empty/></element> <attribute name="b"/> </group> <group> <element name="c"><empty/></element> <attribute name="c"/> </group> </choice> </element></correct>

	<valid><a b=""><b/></a></valid>
	<valid><a c=""><c/></a></valid>

	<invalid><a/></invalid>
	<invalid><b/></invalid>
	<invalid><a b=""><c/></a></invalid>
	<invalid><a c=""><b/></a></invalid>
	<invalid><a b=""><b/><c/></a></invalid>
	<invalid><a b="" c=""><c/></a></invalid>

</testCase>

		</testSuite>

		<testSuite id="mozile.rng.Interleave">
		  <title>Interleave</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Interleave object.</documentation>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <interleave> <element name="b"><empty/></element> <element name="c"><empty/></element> </interleave> </element></correct>

	<valid><a><b/><c/></a></valid>
	<valid><a><c/><b/></a></valid>

	<invalid><b/></invalid>
	<invalid><a/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/><c/></a></invalid>
	<invalid><a><b/><c/><d/></a></invalid>
	<invalid><a><c/><b/><d/></a></invalid>
	<invalid><a><b/><c/><c/></a></invalid>
	<invalid><a><c/><b/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <interleave> <text/> <element name="b"><empty/></element> <element name="c"><empty/></element> </interleave> </element></correct>

	<valid><a><b/><c/></a></valid>
	<valid><a><c/><b/></a></valid>
	<valid><a>text<b/><c/></a></valid>
	<valid><a><c/><b/>text</a></valid>

	<invalid><b/></invalid>
	<invalid><a/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/><c/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <interleave> <element name="b"><empty/></element> <element name="c"><empty/></element> <text/> </interleave> </element></correct>

	<valid><a><b/><c/></a></valid>
	<valid><a><c/><b/></a></valid>
	<valid><a>text<b/><c/></a></valid>
	<valid><a><c/><b/>text</a></valid>

	<invalid><b/></invalid>
	<invalid><a/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/>text</a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/><c/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <optional> <element name="b"><empty/></element> <element name="c"><empty/></element> </optional> </element></correct>

	<valid><a/></valid>
	<valid><a><b/><c/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><b/></a></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>

</testCase>

<testCase>
	<correct><element name="a" xmlns="http://relaxng.org/ns/structure/1.0"> <interleave> <element name="b"><empty/></element> <element name="c"><empty/></element> </interleave> <element name="d"><empty/></element> </element></correct>

	<valid><a><b/><c/><d/></a></valid>
	<valid><a><b/><c/><d/></a></valid>

	<invalid><b/></invalid>
	<invalid><a><c/></a></invalid>
	<invalid><a><b/></a></invalid>
	<invalid><a><b/><c/></a></invalid>
	<invalid><a><c/><b/></a></invalid>
	<invalid><a><b/><c/><c/></a></invalid>
	<invalid><a><c/><b/><b/></a></invalid>

</testCase>

		</testSuite>
    <!--

		<testSuite id="mozile.rng.Attribute">
		  <title>Attribute</title>
		  <section>1</section>
      <documentation>Tests for Mozile's RNG Attribute object.</documentation>



		</testSuite>

		-->
    
  </testSuite>

  <testSuite>
    <title>Official Test Suite</title>
    <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="&#3604;&#3637;">
                <empty/>
              </element>
            </element>
          </correct>
          <valid>
            <foo>&amp;dii;</foo>
          </valid>
        </testCase>
        <testCase>
          <section>3</section>
          <incorrect>
            <element name="&#3637;" 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>&#3637;</name>
              <empty/>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="&#3637;"/>
              <empty/>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <ref name="&#3637;"/>
              </start>
              <define name="&#3637;">
                <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="&#3604;&#3637;"/>
              </start>
              <define name="&#3604;&#3637;">
                <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:&#3637;">
              <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=" 
 	foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name=" 
 	bar"/>
            </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=" 
 	string">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=" 
 	string"/>
            </element>
          </correct>
          <valid>
            <foo>X</foo>
          </valid>
        </testCase>
        <testCase>
          <section>4.2</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <name>
              
 	foo
              
 	</name>
              <attribute>
                <name>
                
 	bar
                
 	</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=" 
 	choice">
                <ref name=" 
 	x"/>
              </start>
              <define name="x">
                <ref name="y"/>
              </define>
              <define name=" 
 	y">
                <grammar>
                  <start combine=" 
 	interleave">
                    <parentRef name=" 
 	z"/>
                  </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 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 name="bar3">
                    <empty/>
                  </element>
                </start>
              </grammar>
            </element>
          </incorrect>
        </testCase>
      </testSuite>
      <testSuite>
        <section>4.18</section>
        <testCase>
          <section>4.18</section>
          <documentation>grammar must have a start</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <define name="foo">
                <element name="foo">
                  <empty/>
                </element>
              </define>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>4.17 is before 4.18</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <empty/>
                </element>
              </start>
              <define name="bar">
                <grammar xmlns="http://relaxng.org/ns/structure/1.0">
                  <define name="foo">
                    <element name="foo">
                      <empty/>
                    </element>
                  </define>
                </grammar>
              </define>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>4.17 is before 4.19</documentation>
          <incorrect>
            <choice xmlns="http://relaxng.org/ns/structure/1.0">
              <element name="foo">
                <empty/>
              </element>
              <group>
                <notAllowed/>
                <grammar xmlns="http://relaxng.org/ns/structure/1.0">
                  <define name="foo">
                    <element name="foo">
                      <empty/>
                    </element>
                  </define>
                </grammar>
              </group>
            </choice>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>every ref must have a def</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <ref name="foo"/>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>4.17 is before 4.18</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <empty/>
                </element>
              </start>
              <define name="foo">
                <ref name="bar"/>
              </define>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>4.17 is before 4.19</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <group>
                    <notAllowed/>
                    <ref name="foo"/>
                  </group>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>every parentRef must have a def</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <grammar xmlns="http://relaxng.org/ns/structure/1.0">
                  <start>
                    <parentRef name="foo"/>
                  </start>
                  <define name="foo">
                    <element name="foo">
                      <empty/>
                    </element>
                  </define>
                </grammar>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>4.17 is before 4.18</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <empty/>
                </element>
              </start>
              <define name="bar">
                <grammar xmlns="http://relaxng.org/ns/structure/1.0">
                  <start>
                    <parentRef name="foo"/>
                  </start>
                  <define name="foo">
                    <element name="foo">
                      <empty/>
                    </element>
                  </define>
                </grammar>
              </define>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <documentation>4.17 is before 4.19</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <group>
                    <notAllowed/>
                    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
                      <start>
                        <parentRef name="foo"/>
                      </start>
                      <define name="foo">
                        <element name="foo">
                          <empty/>
                        </element>
                      </define>
                    </grammar>
                  </group>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <ref name="foo"/>
              </start>
              <define name="foo">
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <grammar xmlns="http://relaxng.org/ns/structure/1.0">
                    <start>
                      <parentRef name="foo"/>
                    </start>
                  </grammar>
                </choice>
              </define>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.18</section>
          <correct>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <ref name="foo"/>
              </start>
              <define name="foo">
                <grammar xmlns="http://relaxng.org/ns/structure/1.0">
                  <start>
                    <ref name="foo"/>
                  </start>
                  <define name="foo">
                    <element name="foo">
                      <empty/>
                    </element>
                  </define>
                </grammar>
              </define>
            </grammar>
          </correct>
          <valid>
            <foo/>
          </valid>
        </testCase>
        <testCase>
          <section>4.18</section>
          <correct>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <grammar>
                  <start>
                    <ref name="foo"/>
                  </start>
                  <define name="foo">
                    <element name="innerFoo">
                      <parentRef name="foo"/>
                    </element>
                  </define>
                </grammar>
              </start>
              <define name="foo">
                <element name="outerFoo">
                  <empty/>
                </element>
              </define>
            </grammar>
          </correct>
          <valid>
            <innerFoo>
              <outerFoo/>
            </innerFoo>
          </valid>
          <invalid>
            <outerFoo/>
          </invalid>
        </testCase>
        <testCase>
          <section>4.18</section>
          <correct>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <ref name="foo"/>
              </start>
              <define name="foo">
                <element name="outerFoo">
                  <grammar>
                    <start>
                      <ref name="foo"/>
                    </start>
                    <define name="foo">
                      <element name="innerFoo">
                        <empty/>
                      </element>
                    </define>
                  </grammar>
                </element>
              </define>
            </grammar>
          </correct>
          <valid>
            <outerFoo>
              <innerFoo/>
            </outerFoo>
          </valid>
          <invalid>
            <innerFoo/>
          </invalid>
        </testCase>
      </testSuite>
      <testSuite>
        <section>4.19</section>
        <testCase>
          <section>4.19</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <ref name="bar"/>
                </element>
              </start>
              <define name="bar">
                <optional>
                  <element name="bar">
                    <empty/>
                  </element>
                  <ref name="bar"/>
                </optional>
              </define>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>4.19</section>
          <correct>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <ref name="bar"/>
                </element>
              </start>
              <define name="bar">
                <element name="bar">
                  <optional>
                    <ref name="bar"/>
                  </optional>
                </element>
              </define>
            </grammar>
          </correct>
          <valid>
            <foo>
              <bar/>
            </foo>
          </valid>
          <valid>
            <foo>
              <bar>
                <bar/>
              </bar>
            </foo>
          </valid>
          <invalid>
            <foo/>
          </invalid>
        </testCase>
        <testCase>
          <section>4.19</section>
          <correct>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <empty/>
                </element>
              </start>
              <define name="bar">
                <ref name="bar"/>
              </define>
            </grammar>
          </correct>
          <valid>
            <foo/>
          </valid>
        </testCase>
        <testCase>
          <section>4.19</section>
          <section>4.20</section>
          <documentation>Tests that recursion detection happens before normalization of notAllowed.</documentation>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <group>
                    <notAllowed/>
                    <ref name="bar"/>
                  </group>
                </choice>
              </start>
              <define name="bar">
                <element name="bar">
                  <empty/>
                </element>
                <optional>
                  <ref name="bar"/>
                </optional>
              </define>
            </grammar>
          </incorrect>
        </testCase>
      </testSuite>
    </testSuite>
    <testSuite>
      <section>6</section>
      <testSuite>
        <section>6.1</section>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <anyName/>
              <empty/>
            </element>
          </correct>
          <valid>
            <foo/>
          </valid>
          <valid>
            <foo xmlns="http://www.example.com"/>
          </valid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <anyName>
                <except>
                  <name ns="">foo</name>
                </except>
              </anyName>
              <empty/>
            </element>
          </correct>
          <invalid>
            <foo/>
          </invalid>
          <valid>
            <foo xmlns="http://www.example.com"/>
          </valid>
          <valid>
            <bar/>
          </valid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <anyName>
                <except>
                  <nsName ns=""/>
                </except>
              </anyName>
              <empty/>
            </element>
          </correct>
          <invalid>
            <foo/>
          </invalid>
          <valid>
            <foo xmlns="http://www.example.com"/>
          </valid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <nsName ns=""/>
              <empty/>
            </element>
          </correct>
          <valid>
            <foo/>
          </valid>
          <invalid>
            <foo xmlns="http://www.example.com"/>
          </invalid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <nsName ns="http://www.example.com"/>
              <empty/>
            </element>
          </correct>
          <invalid>
            <foo/>
          </invalid>
          <invalid>
            <foo xmlns="HTTP://www.example.com"/>
          </invalid>
          <invalid>
            <foo xmlns="http://www.example.com/"/>
          </invalid>
          <valid>
            <foo xmlns="http://www.example.com"/>
          </valid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <nsName ns="http://www.example.com">
                <except>
                  <name ns="http://www.example.com">foo</name>
                </except>
              </nsName>
              <empty/>
            </element>
          </correct>
          <invalid>
            <foo/>
          </invalid>
          <invalid>
            <foo xmlns="http://www.example.com"/>
          </invalid>
          <valid>
            <bar xmlns="http://www.example.com"/>
          </valid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <nsName ns="http://www.example.com">
                <except>
                  <name ns="">foo</name>
                </except>
              </nsName>
              <empty/>
            </element>
          </correct>
          <invalid>
            <bar/>
          </invalid>
          <invalid>
            <foo/>
          </invalid>
          <valid>
            <foo xmlns="http://www.example.com"/>
          </valid>
          <valid>
            <bar xmlns="http://www.example.com"/>
          </valid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <name ns="http://www.example.com">foo</name>
              <empty/>
            </element>
          </correct>
          <valid>
            <foo xmlns="http://www.example.com"/>
          </valid>
          <invalid>
            <foo/>
          </invalid>
          <invalid>
            <bar xmlns="http://www.example.com"/>
          </invalid>
          <invalid>
            <foo xmlns="http://www.example.org"/>
          </invalid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <name ns="">foo</name>
              <empty/>
            </element>
          </correct>
          <invalid>
            <foo xmlns="http://www.example.com"/>
          </invalid>
          <valid>
            <foo/>
          </valid>
          <invalid>
            <bar xmlns="http://www.example.com"/>
          </invalid>
          <invalid>
            <bar/>
          </invalid>
        </testCase>
        <testCase>
          <section>6.1</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0">
              <choice>
                <name ns="">foo</name>
                <name ns="">bar</name>
              </choice>
              <empty/>
            </element>
          </correct>
          <invalid>
            <baz/>
          </invalid>
          <valid>
            <foo/>
          </valid>
          <valid>
            <bar/>
          </valid>
        </testCase>
      </testSuite>
      <testSuite>
        <section>6.2</section>
        <testSuite>
          <section>6.2.1</section>
          <testCase>
            <section>6.2.1</section>
            <correct>
              <choice xmlns="http://relaxng.org/ns/structure/1.0">
                <element name="foo">
                  <empty/>
                </element>
                <element name="bar">
                  <empty/>
                </element>
              </choice>
            </correct>
            <valid>
              <foo/>
            </valid>
            <valid>
              <bar/>
            </valid>
            <invalid>
              <baz/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.1</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <choice>
                  <group>
                    <element name="bar1">
                      <empty/>
                    </element>
                    <element name="bar2">
                      <empty/>
                    </element>
                  </group>
                  <group>
                    <element name="bar1">
                      <empty/>
                    </element>
                    <element name="bar3">
                      <empty/>
                    </element>
                  </group>
                </choice>
              </element>
            </correct>
            <valid>
              <foo>
                <bar1/>
                <bar2/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar1/>
                <bar3/>
              </foo>
            </valid>
            <invalid>
              <foo>
                <bar1/>
              </foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>
                <bar2/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <bar3/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <bar1/>
                <bar2/>
                <bar3/>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.1</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <choice>
                  <group>
                    <attribute name="bar1">
                      <text/>
                    </attribute>
                    <attribute name="bar2">
                      <text/>
                    </attribute>
                  </group>
                  <group>
                    <attribute name="bar1">
                      <text/>
                    </attribute>
                    <attribute name="bar3">
                      <text/>
                    </attribute>
                  </group>
                </choice>
              </element>
            </correct>
            <valid>
              <foo bar1="x" bar2="x"/>
            </valid>
            <valid>
              <foo bar1="x" bar3="x"/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo bar1="x"/>
            </invalid>
            <invalid>
              <foo bar2="x"/>
            </invalid>
            <invalid>
              <foo bar3="x"/>
            </invalid>
            <invalid>
              <foo bar1="x" bar2="x" bar3="x"/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.1</section>
            <correct>
              <choice xmlns="http://relaxng.org/ns/structure/1.0">
                <element name="foo">
                  <element name="bar">
                    <empty/>
                  </element>
                </element>
                <element name="foo">
                  <element name="baz">
                    <empty/>
                  </element>
                </element>
              </choice>
            </correct>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <baz/>
              </foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>
                <bar/>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <foo/>
              </foo>
            </invalid>
            <invalid>
              <bar/>
            </invalid>
            <invalid>
              <fobaz/>
            </invalid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.2</section>
          <testCase>
            <section>6.2.2</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <element name="bar">
                    <empty/>
                  </element>
                  <element name="baz">
                    <empty/>
                  </element>
                </group>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
                <baz/>
              </foo>
            </valid>
            <invalid>
              <foo>
                <baz/>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <bar/>
                <baz/>
                <bar/>
                <baz/>
              </foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <baz/>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.2</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <attribute name="bar">
                    <text/>
                  </attribute>
                  <attribute name="baz">
                    <text/>
                  </attribute>
                </group>
              </element>
            </correct>
            <valid>
              <foo bar="x" baz="x"/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.2</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <attribute name="bar">
                    <text/>
                  </attribute>
                  <attribute name="baz">
                    <text/>
                  </attribute>
                </group>
              </element>
            </correct>
            <valid>
              <foo bar="x" baz="x"/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo bar="x"/>
            </invalid>
            <invalid>
              <foo baz="x"/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.2</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <attribute name="baz">
                    <text/>
                  </attribute>
                  <attribute name="bar">
                    <text/>
                  </attribute>
                </group>
              </element>
            </correct>
            <valid>
              <foo bar="x" baz="x"/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo bar="x"/>
            </invalid>
            <invalid>
              <foo baz="x"/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.2</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <attribute name="bar">
                    <text/>
                  </attribute>
                  <element name="baz">
                    <empty/>
                  </element>
                </group>
              </element>
            </correct>
            <valid>
              <foo bar="x">
                <baz/>
              </foo>
            </valid>
            <invalid>
              <foo>
                <baz/>
              </foo>
            </invalid>
            <invalid>
              <foo bar="x"/>
            </invalid>
            <invalid>
              <foo baz="x">
                <bar/>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.2</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <element name="baz">
                    <empty/>
                  </element>
                  <attribute name="bar">
                    <text/>
                  </attribute>
                </group>
              </element>
            </correct>
            <valid>
              <foo bar="x">
                <baz/>
              </foo>
            </valid>
            <invalid>
              <foo>
                <baz/>
              </foo>
            </invalid>
            <invalid>
              <foo bar="x"/>
            </invalid>
            <invalid>
              <foo baz="x">
                <bar/>
              </foo>
            </invalid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.3</section>
          <testCase>
            <section>6.2.3</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <empty/>
              </element>
            </correct>
            <valid>
              <foo/>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <valid>
              <foo>
                <?target data?>
                <?target data?>
                <?target data?>
                <?target data?>
                </foo>
            </valid>
            <invalid>
              <foo>x</foo>
            </invalid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo bar="x"/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.3</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <attribute name="bar">
                  <empty/>
                </attribute>
              </element>
            </correct>
            <valid>
              <foo bar=""/>
            </valid>
            <valid>
              <foo bar=""/>
            </valid>
            <invalid>
              <foo bar="x"/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.3</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <list>
                  <empty/>
                </list>
              </element>
            </correct>
            <valid>
              <foo/>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <invalid>
              <foo>x</foo>
            </invalid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo bar=""/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.3</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <attribute name="bar">
                  <list>
                    <empty/>
                  </list>
                </attribute>
              </element>
            </correct>
            <valid>
              <foo bar=""/>
            </valid>
            <valid>
              <foo bar=""/>
            </valid>
            <invalid>
              <foo bar="x"/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.3</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <element name="bar">
                    <empty/>
                  </element>
                  <choice>
                    <empty/>
                    <element name="baz">
                      <empty/>
                    </element>
                  </choice>
                </group>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
                <baz/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <invalid>
              <foo></foo>
            </invalid>
            <invalid>
              <foo>
                <bar/>
                <baz/>
                <baz/>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <choice>
                  <empty/>
                  <attribute name="bar">
                    <text/>
                  </attribute>
                </choice>
              </element>
            </correct>
            <valid>
              <foo bar="x"/>
            </valid>
            <valid>
              <foo/>
            </valid>
            <invalid>
              <foo baz="x"/>
            </invalid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.4</section>
          <testCase>
            <section>6.2.4</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <text/>
              </element>
            </correct>
            <valid>
              <foo/>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x <?target data?>
              y</foo>
            </valid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.4</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <text/>
                  <element name="bar">
                    <empty/>
                  </element>
                </group>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>x 
              <bar/></foo>
            </valid>
            <valid>
              <foo>x <?target data?>
              y 
              <bar/></foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>
              <bar/>x</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.4</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <group>
                  <element name="bar">
                    <empty/>
                  </element>
                  <text/>
                </group>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <invalid>
              <foo>x 
              <bar/></foo>
            </invalid>
            <valid>
              <foo>
              <bar/>x <?target data?>
              y</foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <valid>
              <foo>
              <bar/>x</foo>
            </valid>
          </testCase>
          <testCase>
            <section>6.2.4</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <interleave>
                  <element name="bar">
                    <empty/>
                  </element>
                  <text/>
                </interleave>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>x 
              <bar/></foo>
            </valid>
            <valid>
              <foo>
              <bar/>x <?target data?>
              y</foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <valid>
              <foo>
              <bar/>x</foo>
            </valid>
            <valid>
              <foo>x
              <bar/>x</foo>
            </valid>
            <invalid>
              <foo>x
              <bar/>x
              <bar/></foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.4</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <attribute name="bar">
                  <text/>
                </attribute>
              </element>
            </correct>
            <valid>
              <foo bar=""/>
            </valid>
            <valid>
              <foo bar="x"/>
            </valid>
            <valid>
              <foo bar=""/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>
              <bar/>x
              <bar/></foo>
            </invalid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.5</section>
          <testCase>
            <section>6.2.5</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <oneOrMore>
                  <element name="bar">
                    <empty/>
                  </element>
                </oneOrMore>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
                <bar/>
                <bar/>
              </foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.5</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <oneOrMore>
                  <group>
                    <element name="bar">
                      <empty/>
                    </element>
                    <element name="bar">
                      <empty/>
                    </element>
                  </group>
                </oneOrMore>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
                <bar/>
                <bar/>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
                <bar/>
                <bar/>
                <bar/>
                <bar/>
                <bar/>
              </foo>
            </valid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>
                <bar/>
                <bar/>
                <bar/>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.5</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <oneOrMore>
                  <attribute>
                    <nsName ns=""/>
                    <text/>
                  </attribute>
                </oneOrMore>
              </element>
            </correct>
            <valid>
              <foo x=""/>
            </valid>
            <valid>
              <foo x="" y=""/>
            </valid>
            <valid>
              <foo x="" y="" z=""/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo xmlns:ns="http://www.example.com" ns:x=""/>
            </invalid>
            <invalid>
              <foo x="" xmlns:ns="http://www.example.com" ns:x=""/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.5</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <oneOrMore>
                  <choice>
                    <attribute name="bar">
                      <text/>
                    </attribute>
                    <element name="bar">
                      <text/>
                    </element>
                  </choice>
                </oneOrMore>
              </element>
            </correct>
            <valid>
              <foo bar="">
                <bar/>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo bar=""/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.6</section>
          <testCase>
            <section>6.2.6</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <interleave>
                  <element name="bar">
                    <empty/>
                  </element>
                  <element name="baz">
                    <empty/>
                  </element>
                </interleave>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
                <baz/>
              </foo>
            </valid>
            <valid>
              <foo>
                <baz/>
                <bar/>
              </foo>
            </valid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <baz/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <bar/>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.6</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <interleave>
                  <group>
                    <element name="bar1">
                      <empty/>
                    </element>
                    <element name="bar2">
                      <empty/>
                    </element>
                  </group>
                  <element name="baz">
                    <empty/>
                  </element>
                </interleave>
              </element>
            </correct>
            <valid>
              <foo>
                <baz/>
                <bar1/>
                <bar2/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar1/>
                <baz/>
                <bar2/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar1/>
                <bar2/>
                <baz/>
              </foo>
            </valid>
            <invalid>
              <foo>
                <baz/>
                <bar2/>
                <bar1/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <bar2/>
                <bar1/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <baz/>
                <bar2/>
                <bar1/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <baz/>
                <bar1/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <baz/>
                <bar2/>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.6</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <interleave>
                  <attribute name="bar">
                    <text/>
                  </attribute>
                  <attribute name="baz">
                    <text/>
                  </attribute>
                </interleave>
              </element>
            </correct>
            <valid>
              <foo bar="" baz=""/>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo bar=""/>
            </invalid>
            <invalid>
              <foo baz=""/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.6</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <interleave>
                  <element name="bar">
                    <empty/>
                  </element>
                  <attribute name="baz">
                    <text/>
                  </attribute>
                </interleave>
              </element>
            </correct>
            <valid>
              <foo baz="">
                <bar/>
              </foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo bar=""/>
            </invalid>
            <invalid>
              <foo bar="">
                <baz/>
                <baz/>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <baz/>
                <baz/>
              </foo>
            </invalid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.7</section>
          <testCase>
            <section>6.2.7</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <attribute>
                  <name ns="">bar</name>
                  <value type="string" datatypeLibrary="">baz</value>
                </attribute>
              </element>
            </correct>
            <valid>
              <foo bar="baz"/>
            </valid>
            <invalid>
              <foo bar=" baz"/>
            </invalid>
            <invalid>
              <foo bar="b"/>
            </invalid>
            <invalid>
              <foo bar=""/>
            </invalid>
            <invalid>
              <foo bar=""/>
            </invalid>
            <invalid>
              <foo>
                <bar>baz</bar>
              </foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <attribute>
                  <name ns="">bar</name>
                  <choice>
                    <value type="string" datatypeLibrary="">baz</value>
                    <empty/>
                  </choice>
                </attribute>
              </element>
            </correct>
            <valid>
              <foo bar="baz"/>
            </valid>
            <valid>
              <foo bar=""/>
            </valid>
            <invalid>
              <foo bar=" baz"/>
            </invalid>
            <invalid>
              <foo bar="b"/>
            </invalid>
            <invalid>
              <foo>
                <bar>baz</bar>
              </foo>
            </invalid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <attribute>
                  <name ns="">bar</name>
                  <value type="string"/>
                </attribute>
              </element>
            </correct>
            <valid>
              <foo bar=""/>
            </valid>
            <invalid>
              <foo bar=""/>
            </invalid>
            <invalid>
              <foo bar="x"/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <correct>
              <element xmlns="http://relaxng.org/ns/structure/1.0">
                <name ns="">foo</name>
                <group>
                  <element>
                    <name ns="">bar</name>
                    <empty/>
                  </element>
                  <element>
                    <name ns="">baz</name>
                    <empty/>
                  </element>
                </group>
              </element>
            </correct>
            <valid>
              <foo>
                <bar/>
                <baz/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
                <baz/>
              </foo>
            </valid>
            <valid>
              <foo>
              <bar/>
 
              <baz/></foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <bar>
                <bar/>
                <baz/>
              </bar>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="string"/>
              </element>
            </correct>
            <valid>
              <foo/>
            </valid>
            <invalid>
              <foo></foo>
            </invalid>
            <invalid>
              <foo>x</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <choice>
                  <value type="string"/>
                  <empty/>
                </choice>
              </element>
            </correct>
            <valid>
              <foo/>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <invalid>
              <foo>x</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <section>6.2.8</section>
            <section>6.2.10</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <list>
                  <data type="token"/>
                </list>
              </element>
            </correct>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo></foo>
            </invalid>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <invalid>
              <foo>x y</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <section>6.2.8</section>
            <requires datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"/>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="string" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
                  <param name="minLength">2</param>
                </data>
              </element>
            </correct>
            <valid>
              <foo>xx</foo>
            </valid>
            <valid>
              <foo>xxx</foo>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <invalid>
              <foo>x</foo>
            </invalid>
            <invalid>
              <foo></foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <choice>
                  <value>x</value>
                  <element name="bar">
                    <empty/>
                  </element>
                </choice>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <invalid>
              <foo>y</foo>
            </invalid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <invalid>
              <foo>x
              <bar/></foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>
              <bar/>x</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.7</section>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <choice>
                  <value>x</value>
                  <mixed>
                    <element name="bar">
                      <empty/>
                    </element>
                  </mixed>
                </choice>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <invalid>
              <foo>y</foo>
            </invalid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>
                <bar/>
              </foo>
            </valid>
            <valid>
              <foo>x
              <bar/></foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <valid>
              <foo>
              <bar/>x</foo>
            </valid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.8</section>
          <testCase>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="string">
                  <except>
                    <choice>
                      <value>x</value>
                      <value>y</value>
                    </choice>
                  </except>
                </data>
              </element>
            </correct>
            <valid>
              <foo>xyzzy</foo>
            </valid>
            <invalid>
              <foo>x</foo>
            </invalid>
            <invalid>
              <foo>y</foo>
            </invalid>
            <invalid>
              <foo>x</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="string"/>
              </element>
            </correct>
            <valid>
              <foo/>
            </valid>
          </testCase>
          <testCase>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value/>
              </element>
            </correct>
            <valid>
              <foo/>
            </valid>
          </testCase>
          <testCase>
            <section>6.2.8</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="string">
                  <except>
                    <value/>
                  </except>
                </data>
              </element>
            </correct>
            <invalid>
              <foo/>
            </invalid>
            <valid>
              <foo>x</foo>
            </valid>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.9</section>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="string" datatypeLibrary=""/>
              </element>
            </correct>
            <valid>
              <foo>xyzzy</foo>
            </valid>
            <valid>
              <foo>x <?target data?>
              y <?target data?>
              z</foo>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo bar=""/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="token" datatypeLibrary=""/>
              </element>
            </correct>
            <valid>
              <foo>xyzzy</foo>
            </valid>
            <valid>
              <foo>x <?target data?>
              y <?target data?>
              z</foo>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <valid>
              <foo></foo>
            </valid>
            <invalid>
              <foo>
                <bar/>
              </foo>
            </invalid>
            <invalid>
              <foo bar=""/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="string" datatypeLibrary="">x</value>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <invalid>
              <foo>xy</foo>
            </invalid>
            <invalid>
              <foo>x</foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="string" datatypeLibrary="">x</value>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <invalid>
              <foo>xy</foo>
            </invalid>
            <invalid>
              <foo>x</foo>
            </invalid>
            <invalid>
              <foo/>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="token" datatypeLibrary="">x</value>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>
              
	 x
              
	</foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>xy</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="token" datatypeLibrary="">x y</value>
              </element>
            </correct>
            <valid>
              <foo>x y</foo>
            </valid>
            <valid>
              <foo>x y</foo>
            </valid>
            <valid>
              <foo>x
              
	 y</foo>
            </valid>
            <invalid>
              <foo>xy</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="token" datatypeLibrary="">
                
	 x
                
	</value>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>
	x 
              </foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>xy</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="token" datatypeLibrary="">x
                
	 y</value>
              </element>
            </correct>
            <valid>
              <foo>x y</foo>
            </valid>
            <valid>
              <foo>x y</foo>
            </valid>
            <valid>
              <foo>x y</foo>
            </valid>
            <valid>
              <foo>x
	y</foo>
            </valid>
            <valid>
              <foo>x 
              y</foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>xy</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <incorrect>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="decimal" datatypeLibrary=""/>
              </element>
            </incorrect>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <incorrect>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <value type="decimal" datatypeLibrary=""/>
              </element>
            </incorrect>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <incorrect>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="string" datatypeLibrary="">
                  <param name="length">2</param>
                </data>
              </element>
            </incorrect>
          </testCase>
          <testCase>
            <section>6.2.9</section>
            <incorrect>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <data type="token" datatypeLibrary="">
                  <param name="length">2</param>
                </data>
              </element>
            </incorrect>
          </testCase>
        </testSuite>
        <testSuite>
          <section>6.2.10</section>
          <testCase>
            <section>6.2.10</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <list>
                  <value type="string">x</value>
                </list>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x</foo>
            </valid>
            <invalid>
              <foo>x x</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.10</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <list>
                  <oneOrMore>
                    <value type="string">x</value>
                  </oneOrMore>
                </list>
              </element>
            </correct>
            <valid>
              <foo>x</foo>
            </valid>
            <valid>
              <foo>x x x x</foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>x y</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.10</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <list>
                  <group>
                    <value type="string">x</value>
                    <value type="string">y</value>
                  </group>
                </list>
              </element>
            </correct>
            <valid>
              <foo>x y</foo>
            </valid>
            <valid>
              <foo>x y</foo>
            </valid>
            <valid>
              <foo>
x
              y	</foo>
            </valid>
            <invalid>
              <foo>x</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.10</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <list>
                  <group>
                    <data type="token"/>
                    <data type="token"/>
                  </group>
                </list>
              </element>
            </correct>
            <valid>
              <foo>x y</foo>
            </valid>
            <invalid>
              <foo/>
            </invalid>
            <invalid>
              <foo>x y z</foo>
            </invalid>
          </testCase>
          <testCase>
            <section>6.2.10</section>
            <correct>
              <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
                <list>
                  <value>x y</value>
                </list>
              </element>
            </correct>
            <invalid>
              <foo>x y</foo>
            </invalid>
          </testCase>
        </testSuite>
      </testSuite>
    </testSuite>
    <testSuite>
      <section>7</section>
      <testSuite>
        <section>7.1</section>
        <testCase>
          <section>7.1.1</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <attribute name="bar">
                    <element name="baz">
                      <empty/>
                    </element>
                  </attribute>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.1</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <attribute name="bar">
                    <choice>
                      <element name="baz">
                        <empty/>
                      </element>
                      <text/>
                    </choice>
                  </attribute>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.1</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <attribute name="bar">
                    <attribute name="baz"/>
                  </attribute>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.1</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <attribute name="bar">
                    <choice>
                      <attribute name="baz"/>
                      <text/>
                    </choice>
                  </attribute>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <group>
                      <attribute name="bar"/>
                      <attribute name="baz"/>
                    </group>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <group>
                      <attribute>
                        <anyName/>
                      </attribute>
                      <attribute>
                        <anyName/>
                      </attribute>
                    </group>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <choice>
                      <group>
                        <choice>
                          <attribute name="bar"/>
                          <attribute name="baz"/>
                        </choice>
                        <choice>
                          <attribute name="bar"/>
                          <attribute name="baz"/>
                        </choice>
                      </group>
                      <attribute name="bar"/>
                    </choice>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <interleave>
                      <attribute name="bar"/>
                      <attribute name="baz"/>
                    </interleave>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <interleave>
                      <attribute>
                        <anyName/>
                      </attribute>
                      <attribute>
                        <anyName/>
                      </attribute>
                    </interleave>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <choice>
                      <interleave>
                        <choice>
                          <attribute name="bar"/>
                          <attribute name="baz"/>
                        </choice>
                        <choice>
                          <attribute name="bar"/>
                          <attribute name="baz"/>
                        </choice>
                      </interleave>
                      <attribute name="bar"/>
                    </choice>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <list>
                      <data type="token"/>
                    </list>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <choice>
                      <list>
                        <data type="token"/>
                      </list>
                      <data type="token"/>
                    </choice>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <element name="bar">
                      <empty/>
                    </element>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <choice>
                      <data type="token"/>
                      <element name="bar">
                        <empty/>
                      </element>
                    </choice>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <attribute name="bar">
                      <empty/>
                    </attribute>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <choice>
                      <attribute name="bar">
                        <empty/>
                      </attribute>
                      <data type="token"/>
                    </choice>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <choice>
                      <text/>
                      <data type="token"/>
                    </choice>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <interleave>
                      <value>x</value>
                      <value>y</value>
                    </interleave>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.3</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <list>
                    <choice>
                      <interleave>
                        <value>x</value>
                        <value>y</value>
                      </interleave>
                      <value>z</value>
                    </choice>
                  </list>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <attribute name="bar"/>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <element name="bar">
                        <empty/>
                      </element>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <text/>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <list>
                        <data type="token"/>
                      </list>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <group>
                        <data type="token"/>
                        <data type="token"/>
                      </group>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <interleave>
                        <data type="token"/>
                        <data type="token"/>
                      </interleave>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <oneOrMore>
                        <data type="token"/>
                      </oneOrMore>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.4</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <data type="string">
                    <except>
                      <empty/>
                    </except>
                  </data>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <attribute name="foo"/>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <data type="string"/>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <data type="string"/>
                  <element name="foo">
                    <empty/>
                  </element>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <value>foo</value>
                  <element name="foo">
                    <empty/>
                  </element>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <text/>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <text/>
                  <element name="foo">
                    <empty/>
                  </element>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <list>
                  <data type="token"/>
                </list>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <list>
                    <data type="token"/>
                  </list>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <group>
                  <element name="foo">
                    <empty/>
                  </element>
                  <element name="foo">
                    <empty/>
                  </element>
                </group>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <group>
                    <element name="foo">
                      <empty/>
                    </element>
                    <element name="foo">
                      <empty/>
                    </element>
                  </group>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <interleave>
                  <element name="foo">
                    <empty/>
                  </element>
                  <element name="foo">
                    <empty/>
                  </element>
                </interleave>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <interleave>
                    <element name="foo">
                      <empty/>
                    </element>
                    <element name="foo">
                      <empty/>
                    </element>
                  </interleave>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <oneOrMore>
                  <element name="foo">
                    <empty/>
                  </element>
                </oneOrMore>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <oneOrMore>
                    <element name="foo">
                      <empty/>
                    </element>
                  </oneOrMore>
                  <element name="foo">
                    <empty/>
                  </element>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <empty/>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <choice>
                  <element name="foo">
                    <empty/>
                  </element>
                  <empty/>
                </choice>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <section>7</section>
          <section>4.18</section>
          <documentation>Tests that constraints are post-normalization</documentation>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
              <grammar>
                <start>
                  <text/>
                </start>
              </grammar>
            </element>
          </correct>
          <valid>
            <foo>text</foo>
          </valid>
        </testCase>
        <testCase>
          <section>7.1.5</section>
          <section>7</section>
          <section>4.18</section>
          <incorrect>
            <text xmlns="http://relaxng.org/ns/structure/1.0"/>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.1.1</section>
          <section>7</section>
          <section>4.20</section>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
              <optional>
                <attribute name="bar">
                  <group>
                    <notAllowed/>
                    <attribute name="baz"/>
                  </group>
                </attribute>
              </optional>
            </element>
          </correct>
          <valid>
            <foo/>
          </valid>
        </testCase>
        <testCase>
          <section>7.1.1</section>
          <section>7</section>
          <section>4.20</section>
          <documentation>The nested attribute element is normalized out because of the not allowed.</documentation>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
              <attribute name="bar">
                <choice>
                  <text/>
                  <group>
                    <notAllowed/>
                    <attribute name="baz"/>
                  </group>
                </choice>
              </attribute>
            </element>
          </correct>
          <valid>
            <foo bar="baz"/>
          </valid>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <section>7</section>
          <section>4.12</section>
          <documentation>The group element is normalized out.</documentation>
          <correct>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <group>
                      <attribute>
                        <anyName/>
                      </attribute>
                    </group>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </correct>
          <valid>
            <foo xyzzy1="val1" xyzzy2="val2"/>
          </valid>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <section>7</section>
          <section>4.21</section>
          <documentation>The group element is normalized out.</documentation>
          <correct>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <oneOrMore>
                    <group>
                      <attribute>
                        <anyName/>
                      </attribute>
                      <empty/>
                    </group>
                  </oneOrMore>
                </element>
              </start>
            </grammar>
          </correct>
          <valid>
            <foo xyzzy1="val1" xyzzy2="val2"/>
          </valid>
        </testCase>
        <testCase>
          <section>7.1.2</section>
          <section>7</section>
          <section>4.20</section>
          <documentation>The attribute elements are all normalized out.</documentation>
          <correct>
            <element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
              <optional>
                <attribute name="a1">
                  <attribute name="a2">
                    <attribute name="a3">
                      <notAllowed/>
                    </attribute>
                  </attribute>
                </attribute>
              </optional>
            </element>
          </correct>
          <valid>
            <foo/>
          </valid>
        </testCase>
      </testSuite>
      <testSuite>
        <section>7.2</section>
        <testCase>
          <section>7.2</section>
          <incorrect>
            <grammar xmlns="http://relaxng.org/ns/structure/1.0">
              <start>
                <element name="foo">
                  <group>
                    <data type="token"/>
                    <data type="token"/>
                  </group>
                </element>
              </start>
            </grammar>
          </incorrect>
        </testCase>
        <testCase>
          <documentation>Checks that normalization of notAllowed happens before string sequence checking.</documentation>
          <section>7.2</section>
          <section>4.20</section>
          <correct>
            <choice xmlns="http://relaxng.org/ns/structure/1.0">
              <element name="foo">
                <empty/>
              </element>
              <group>
                <notAllowed/>
                <element name="bar">
                  <group>
                    <data type="token"/>
                    <data type="token"/>
                  </group>
                </element>
              </group>
            </choice>
          </correct>
          <valid>
            <foo/>
          </valid>
        </testCase>
        <testCase>
          <section>4.20</section>
          <section>7.2</section>
          <documentation>notAllowed in an element is not normalized</documentation>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <choice>
                <group>
                  <element name="bar">
                    <notAllowed/>
                  </element>
                  <data type="token"/>
                  <data type="token"/>
                </group>
                <element name="baz">
                  <empty/>
                </element>
              </choice>
            </element>
          </incorrect>
        </testCase>
      </testSuite>
      <testSuite>
        <section>7.3</section>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <attribute name="bar"/>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <zeroOrMore>
                <attribute name="bar"/>
              </zeroOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <correct>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute name="bar"/>
              </oneOrMore>
            </element>
          </correct>
          <valid>
            <foo bar="xx"/>
          </valid>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <attribute name="bar"/>
                <attribute name="bar"/>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <optional>
                <attribute name="bar"/>
              </optional>
              <optional>
                <attribute name="bar"/>
              </optional>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <oneOrMore>
                <attribute>
                  <anyName/>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <oneOrMore>
                <attribute>
                  <anyName>
                    <except>
                      <name>baz</name>
                    </except>
                  </anyName>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <correct>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <oneOrMore>
                <attribute>
                  <anyName>
                    <except>
                      <name>bar</name>
                    </except>
                  </anyName>
                </attribute>
              </oneOrMore>
            </element>
          </correct>
          <valid>
            <foo bar="val" xyzzy="anotherval"/>
          </valid>
          <valid>
            <foo bar="val" baz=""/>
          </valid>
          <invalid>
            <foo bar="val"/>
          </invalid>
          <invalid>
            <foo/>
          </invalid>
          <invalid>
            <foo xyzzy="val"/>
          </invalid>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <oneOrMore>
                <attribute>
                  <nsName ns=""/>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <oneOrMore>
                <attribute>
                  <nsName ns="">
                    <except>
                      <name>baz</name>
                    </except>
                  </nsName>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute>
                  <anyName/>
                </attribute>
              </oneOrMore>
              <oneOrMore>
                <attribute>
                  <nsName ns=""/>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute>
                  <anyName/>
                </attribute>
              </oneOrMore>
              <oneOrMore>
                <attribute>
                  <anyName/>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute>
                  <nsName ns=""/>
                </attribute>
              </oneOrMore>
              <oneOrMore>
                <attribute>
                  <nsName ns="">
                    <except>
                      <name>bar</name>
                    </except>
                  </nsName>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute>
                  <anyName>
                    <except>
                      <nsName>
                        <except>
                          <name>foo</name>
                        </except>
                      </nsName>
                    </except>
                  </anyName>
                </attribute>
              </oneOrMore>
              <attribute name="foo"/>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute>
                  <anyName>
                    <except>
                      <nsName>
                        <except>
                          <name>foo</name>
                        </except>
                      </nsName>
                    </except>
                  </anyName>
                </attribute>
              </oneOrMore>
              <oneOrMore>
                <attribute>
                  <nsName/>
                </attribute>
              </oneOrMore>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <correct>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute>
                  <anyName>
                    <except>
                      <nsName>
                        <except>
                          <name>bar</name>
                        </except>
                      </nsName>
                    </except>
                  </anyName>
                </attribute>
              </oneOrMore>
              <attribute name="baz"/>
            </element>
          </correct>
          <valid>
            <foo bar="xx" baz="yy"/>
          </valid>
          <invalid>
            <foo x="xx" baz="yy"/>
          </invalid>
          <valid>
            <foo xmlns:eg="http://www.example.com/" eg:x="xx" baz="yy"/>
          </valid>
        </testCase>
        <testCase>
          <section>7.3</section>
          <correct>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <oneOrMore>
                <attribute>
                  <nsName ns="http://www.example.com/1"/>
                </attribute>
              </oneOrMore>
              <oneOrMore>
                <attribute>
                  <nsName ns="http://www.example.com/2"/>
                </attribute>
              </oneOrMore>
            </element>
          </correct>
          <valid>
            <foo xmlns:eg1="http://www.example.com/1" xmlns:eg2="http://www.example.com/2" eg1:x="xx" eg2:y="yy"/>
          </valid>
        </testCase>
        <testCase>
          <section>7.3</section>
          <correct>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <choice>
                <attribute name="bar"/>
                <attribute name="bar"/>
              </choice>
            </element>
          </correct>
          <valid>
            <foo bar="xx"/>
          </valid>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute name="bar"/>
              <choice>
                <attribute name="baz"/>
                <attribute name="bar"/>
              </choice>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute>
                <anyName/>
                <text/>
              </attribute>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute>
                <nsName ns=""/>
                <text/>
              </attribute>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.3</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <attribute>
                <choice>
                  <nsName ns=""/>
                  <name>foo</name>
                </choice>
                <text/>
              </attribute>
            </element>
          </incorrect>
        </testCase>
      </testSuite>
      <testSuite>
        <section>7.4</section>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <element name="bar">
                  <empty/>
                </element>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <interleave>
                  <element name="baz">
                    <empty/>
                  </element>
                  <element name="bar">
                    <empty/>
                  </element>
                </interleave>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <group>
                  <element name="baz">
                    <empty/>
                  </element>
                  <element name="bar">
                    <empty/>
                  </element>
                </group>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <group>
                  <element name="baz">
                    <empty/>
                  </element>
                  <interleave>
                    <element name="baz">
                      <empty/>
                    </element>
                    <element name="bar">
                      <empty/>
                    </element>
                  </interleave>
                </group>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <optional>
                  <element name="bar">
                    <empty/>
                  </element>
                </optional>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <element>
                  <nsName ns=""/>
                  <empty/>
                </element>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <element>
                  <anyName/>
                  <empty/>
                </element>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <element name="bar">
                  <notAllowed/>
                </element>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <correct>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <element name="bar">
                  <empty/>
                </element>
                <element>
                  <anyName>
                    <except>
                      <name>bar</name>
                    </except>
                  </anyName>
                  <empty/>
                </element>
              </interleave>
            </element>
          </correct>
          <valid>
            <foo>
              <bar/>
              <baz/>
            </foo>
          </valid>
        </testCase>
        <testCase>
          <section>7.4</section>
          <correct>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <choice>
                  <element name="bar">
                    <empty/>
                  </element>
                  <element name="bar">
                    <text/>
                  </element>
                </choice>
                <element name="baz">
                  <empty/>
                </element>
              </interleave>
            </element>
          </correct>
          <valid>
            <foo>
              <bar/>
              <baz/>
            </foo>
          </valid>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <interleave>
                <text/>
                <text/>
              </interleave>
            </element>
          </incorrect>
        </testCase>
        <testCase>
          <section>7.4</section>
          <incorrect>
            <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
              <mixed>
                <mixed>
                  <element name="bar">
                    <empty/>
                  </element>
                </mixed>
                <element name="baz">
                  <empty/>
                </element>
              </mixed>
            </element>
          </incorrect>
        </testCase>
      </testSuite>
    </testSuite>
    <testSuite>
      <documentation>Regressions</documentation>
      <testCase>
        <correct>
          <grammar xmlns="http://relaxng.org/ns/structure/1.0">
            <start>
              <element name="foo">
                <choice>
                  <group>
                    <attribute name="bar">
                      <empty/>
                    </attribute>
                    <element name="baz1">
                      <empty/>
                    </element>
                  </group>
                  <group>
                    <attribute name="bar">
                      <text/>
                    </attribute>
                    <element name="baz2">
                      <empty/>
                    </element>
                  </group>
                </choice>
              </element>
            </start>
          </grammar>
        </correct>
        <valid>
          <foo bar="">
            <baz1/>
          </foo>
        </valid>
      </testCase>
      <testCase>
        <correct>
          <notAllowed xmlns="http://relaxng.org/ns/structure/1.0"/>
        </correct>
        <invalid>
          <foo/>
        </invalid>
      </testCase>
    </testSuite>
  </testSuite>
</testSuite>
