Edit

kc3-lang/libxml2/test/relaxng/testsuite.xml

Branch :

  • Show log

    Commit

  • Author : Daniel Veillard
    Date : 2003-03-21 12:43:18
    Hash : 0e3d3ce2
    Message : fixed xmlRelaxNGNodeMatchesList augmented the test suite this fixes some * relaxng.c: fixed xmlRelaxNGNodeMatchesList * test/relaxng/testsuite.xml: augmented the test suite * result/relaxng/spec1* result/relaxng/tutor12_1*: this fixes some schemas validation tests in the presence of foreign namespaces. Daniel

  • test/relaxng/testsuite.xml
  • <testSuite>
    <author>Daniel Veillard</author>
    <email>daniel@veillard.com</email>
    <documentation>For libxml2 implementation of Relax NG spec.</documentation>
    <testSuite>
    <documentation>Test of node matches</documentation>
    <testCase>
    <correct>
    <element xmlns="http://relaxng.org/ns/structure/1.0">
      <anyName>
        <except>
          <nsName ns="http://example.org"/>
        </except>
      </anyName>
      <empty/>
    </element>
    </correct>
    <valid>
    <foo/>
    </valid>
    <valid>
    <foo xmlns="http://example.org/"/>
    </valid>
    <valid>
    <foo xmlns="http://EXAMPLE.ORG"/>
    </valid>
    <invalid>
    <foo xmlns="http://example.org"/>
    </invalid>
    <invalid>
    <a:foo xmlns:a="http://example.org"/>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="top" xmlns="http://relaxng.org/ns/structure/1.0">
      <interleave>
        <element name="foo" ns="http://example.org">
          <empty/>
        </element>
        <element>
          <anyName>
    	<except>
    	  <nsName ns="http://example.org"/>
    	</except>
          </anyName>
          <empty/>
        </element>
      </interleave>
    </element>
    </correct>
    <invalid>
    <top>
    <foo/>
    <bar/>
    </top>
    </invalid>
    <invalid>
    <top>
    <foo xmlns="http://example.org"/>
    <bar xmlns="http://example.org"/>
    </top>
    </invalid>
    <valid>
    <top>
    <foo xmlns="http://example.org"/>
    <bar/>
    </top>
    </valid>
    <valid>
    <top>
    <bar/>
    <foo xmlns="http://example.org"/>
    </top>
    </valid>
    <valid>
    <top>
    <foo xmlns="http://example.org"/>
    <bar xmlns="http://example.org/"/>
    </top>
    </valid>
    <valid>
    <top>
    <bar xmlns="http://example.org/"/>
    <foo xmlns="http://example.org"/>
    </top>
    </valid>
    </testCase>
    </testSuite>
    <testSuite>
    <documentation>Test of indeterminism</documentation>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <zeroOrMore>
        <element name="bar">
          <empty/>
        </element>
      </zeroOrMore>
      <element name="baz">
        <empty/>
      </element>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <baz/>
    </foo>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <zeroOrMore>
        <element name="bar">
          <empty/>
        </element>
      </zeroOrMore>
      <element name="bar">
        <empty/>
      </element>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <group>
        <zeroOrMore>
          <element name="bar">
            <empty/>
          </element>
        </zeroOrMore>
        <element name="baz">
          <empty/>
        </element>
      </group>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <baz/>
    </foo>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <group>
        <zeroOrMore>
          <element name="bar">
            <empty/>
          </element>
        </zeroOrMore>
        <element name="bar">
          <empty/>
        </element>
      </group>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <choice>
        <zeroOrMore>
          <element name="bar">
            <empty/>
          </element>
        </zeroOrMore>
        <element name="baz">
          <empty/>
        </element>
      </choice>
    </element>
    </correct>
    <valid>
    <foo/>
    </valid>
    <valid>
    <foo>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <invalid>
    <foo>
      <bar/>
      <baz/>
    </foo>
    </invalid>
    <invalid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <bar/>
      <baz/>
    </foo>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <choice>
        <zeroOrMore>
          <element name="bar">
            <empty/>
          </element>
        </zeroOrMore>
        <element name="baz">
          <empty/>
        </element>
      </choice>
      <element name="baz">
        <empty/>
      </element>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <baz/>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <baz/>
    </foo>
    </valid>
    <invalid>
    <foo>
      <bar/>
      <baz/>
      <baz/>
    </foo>
    </invalid>
    <invalid>
    <foo>
      <baz/>
      <bar/>
      <baz/>
    </foo>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <choice>
        <zeroOrMore>
          <element name="bar">
            <empty/>
          </element>
        </zeroOrMore>
        <element name="bar">
          <empty/>
        </element>
      </choice>
    </element>
    </correct>
    <valid>
    <foo/>
    </valid>
    <valid>
    <foo>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <choice>
        <zeroOrMore>
          <choice>
            <element name="bar">
              <empty/>
            </element>
            <element name="baz">
              <empty/>
            </element>
          </choice>
        </zeroOrMore>
        <element name="bar">
          <empty/>
        </element>
      </choice>
    </element>
    </correct>
    <valid>
    <foo/>
    </valid>
    <valid>
    <foo>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <baz/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <baz/>
      <baz/>
      <baz/>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <baz/>
      <bar/>
      <baz/>
      <bar/>
    </foo>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <optional>
        <element name="bar">
          <empty/>
        </element>
      </optional>
      <element name="baz">
        <empty/>
      </element>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <baz/>
    </foo>
    </valid>
    <invalid>
    <foo>
      <bar/>
      <bar/>
      <baz/>
    </foo>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <optional>
        <element name="bar">
          <empty/>
        </element>
      </optional>
      <element name="bar">
        <empty/>
      </element>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <invalid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <optional>
        <oneOrMore>
          <element name="bar">
            <empty/>
          </element>
        </oneOrMore>
      </optional>
      <element name="baz">
        <empty/>
      </element>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <baz/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <baz/>
    </foo>
    </valid>
    <invalid>
    <foo>
      <bar/>
      <bar/>
    </foo>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <optional>
        <oneOrMore>
          <element name="bar">
            <empty/>
          </element>
        </oneOrMore>
      </optional>
      <element name="bar">
        <empty/>
      </element>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
      <group>
        <zeroOrMore>
          <choice>
            <element name="bar">
              <empty/>
            </element>
            <element name="baz">
              <empty/>
            </element>
          </choice>
        </zeroOrMore>
        <element name="bar">
          <empty/>
        </element>
      </group>
    </element>
    </correct>
    <invalid>
    <foo/>
    </invalid>
    <valid>
    <foo>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <baz/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <bar/>
      <bar/>
      <bar/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <baz/>
      <baz/>
      <baz/>
      <bar/>
    </foo>
    </valid>
    <valid>
    <foo>
      <baz/>
      <bar/>
      <baz/>
      <bar/>
    </foo>
    </valid>
    <invalid>
    <foo>
      <bar/>
      <baz/>
      <bar/>
      <baz/>
    </foo>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="list" xmlns="http://relaxng.org/ns/structure/1.0">
      <oneOrMore>
        <element name="label">
          <empty/>
        </element>
        <optional>
          <element name="opt">
            <empty/>
          </element>
        </optional>
        <element name="item">
          <empty/>
        </element>
      </oneOrMore>
    </element>
    </correct>
    <invalid>
    <list>
    </list>
    </invalid>
    <valid>
    <list>
      <label/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <item/>
      <label/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <opt/>
      <item/>
      <label/>
      <opt/>
      <item/>
    </list>
    </valid>
    <invalid>
    <list>
      <label/>
      <item/>
      <label/>
      <opt/>
      <opt/>
      <item/>
    </list>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="list" xmlns="http://relaxng.org/ns/structure/1.0">
      <oneOrMore>
        <element name="label">
          <empty/>
        </element>
        <zeroOrMore>
          <element name="opt">
            <empty/>
          </element>
        </zeroOrMore>
        <element name="item">
          <empty/>
        </element>
      </oneOrMore>
    </element>
    </correct>
    <invalid>
    <list>
    </list>
    </invalid>
    <valid>
    <list>
      <label/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <item/>
      <label/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <opt/>
      <item/>
      <label/>
      <opt/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <item/>
      <label/>
      <opt/>
      <opt/>
      <item/>
    </list>
    </valid>
    </testCase>
    <testCase>
    <correct>
    <element name="list" xmlns="http://relaxng.org/ns/structure/1.0">
      <oneOrMore>
        <element name="label">
          <empty/>
        </element>
        <zeroOrMore>
          <element name="opt">
            <empty/>
          </element>
          <element name="opt2">
            <empty/>
          </element>
        </zeroOrMore>
        <element name="item">
          <empty/>
        </element>
      </oneOrMore>
    </element>
    </correct>
    <invalid>
    <list>
    </list>
    </invalid>
    <valid>
    <list>
      <label/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <item/>
      <label/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <opt/>
      <opt2/>
      <item/>
      <label/>
      <opt/>
      <opt2/>
      <item/>
    </list>
    </valid>
    <valid>
    <list>
      <label/>
      <item/>
      <label/>
      <opt/>
      <opt2/>
      <opt/>
      <opt2/>
      <item/>
    </list>
    </valid>
    <invalid>
    <list>
      <label/>
      <opt/>
      <item/>
      <label/>
      <item/>
    </list>
    </invalid>
    <invalid>
    <list>
      <label/>
      <item/>
      <label/>
      <opt2/>
      <opt/>
      <item/>
    </list>
    </invalid>
    <invalid>
    <list>
      <label/>
      <item/>
      <label/>
      <opt/>
      <opt2/>
      <opt/>
      <item/>
    </list>
    </invalid>
    </testCase>
    </testSuite>
    <testSuite>
    <documentation>Test of grammars merging</documentation>
    <testCase>
    <resource name="dbk.rng">
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <ref name="p"/>
      </start>
      <define name="p.ext">
        <notAllowed/>
      </define>
      <define name="p">
        <element name="p">
          <choice>
            <ref name="p.ext"/>
    	<empty/>
            <element name="a">
              <text/>
            </element>
          </choice>
        </element>
      </define>
    </grammar>
    </resource>
    <correct>
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <grammar>
          <include href="dbk.rng"/>
          <define name="p.ext" combine="choice">
            <element name="b">
              <text/>
            </element>
          </define>
        </grammar>
      </start>
    </grammar>
    </correct>
    <valid>
    <p/>
    </valid>
    <valid>
    <p>
      <a/>
    </p>
    </valid>
    <valid>
    <p>
      <b/>
    </p>
    </valid>
    <invalid>
    <b/>
    </invalid>
    <invalid>
    <p>
      <b/>
      <b/>
    </p>
    </invalid>
    </testCase>
    <testCase>
    <resource name="dbk.rng">
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <ref name="p"/>
      </start>
      <define name="p.ext">
        <notAllowed/>
      </define>
      <define name="p">
        <element name="p">
          <choice>
            <ref name="p.ext"/>
    	<empty/>
            <element name="a">
              <text/>
            </element>
          </choice>
        </element>
      </define>
      <define name="c">
        <element name="c">
          <empty/>
        </element>
      </define>
    </grammar>
    </resource>
    <correct>
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <grammar>
          <include href="dbk.rng"/>
          <define name="p.ext" combine="choice">
            <choice>
    	  <ref name="c"/>
    	  <parentRef name="d"/>
              <element name="b">
                <text/>
              </element>
            </choice>
          </define>
        </grammar>
      </start>
      <define name="d">
        <element name="d">
          <empty/>
        </element>
      </define>
    </grammar>
    </correct>
    <valid>
    <p/>
    </valid>
    <valid>
    <p>
      <a/>
    </p>
    </valid>
    <valid>
    <p>
      <b/>
    </p>
    </valid>
    <valid>
    <p>
      <c/>
    </p>
    </valid>
    <valid>
    <p>
      <d/>
    </p>
    </valid>
    <invalid>
    <b/>
    </invalid>
    <invalid>
    <c/>
    </invalid>
    <invalid>
    <d/>
    </invalid>
    <invalid>
    <p>
      <b/>
      <c/>
    </p>
    </invalid>
    <invalid>
    <p>
      <d/>
      <c/>
    </p>
    </invalid>
    </testCase>
    <testCase>
    <resource name="dbk.rng">
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <ref name="p"/>
      </start>
      <define name="p.ext">
        <notAllowed/>
      </define>
      <define name="p">
        <element name="p">
          <choice>
            <ref name="p.ext"/>
    	<empty/>
            <element name="a">
              <text/>
            </element>
          </choice>
        </element>
      </define>
      <define name="c">
        <element name="c">
          <empty/>
        </element>
      </define>
    </grammar>
    </resource>
    <resource name="proof.rng">
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <ref name="e"/>
      </start>
      <define name="d">
        <element name="d">
          <empty/>
        </element>
      </define>
      <define name="e">
        <element name="e">
          <empty/>
        </element>
      </define>
      <define name="f">
        <element name="f">
          <empty/>
        </element>
      </define>
    </grammar>
    </resource>
    <correct>
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <grammar>
          <include href="dbk.rng"/>
          <define name="p.ext" combine="choice">
            <choice>
    	  <ref name="c"/>
    	  <grammar>
    	    <include href="proof.rng"/>
    	    <start combine="choice">
    	      <ref name="d"/>
    	    </start>
    	  </grammar>
              <element name="b">
                <text/>
              </element>
            </choice>
          </define>
        </grammar>
      </start>
      <define name="g">
        <element name="g">
          <empty/>
        </element>
      </define>
    </grammar>
    </correct>
    <valid>
    <p/>
    </valid>
    <valid>
    <p>
      <a/>
    </p>
    </valid>
    <valid>
    <p>
      <b/>
    </p>
    </valid>
    <valid>
    <p>
      <c/>
    </p>
    </valid>
    <valid>
    <p>
      <d/>
    </p>
    </valid>
    <valid>
    <p>
      <e/>
    </p>
    </valid>
    <invalid>
    <p>
      <f/>
    </p>
    </invalid>
    <invalid>
    <p>
      <g/>
    </p>
    </invalid>
    <invalid>
    <b/>
    </invalid>
    <invalid>
    <c/>
    </invalid>
    <invalid>
    <d/>
    </invalid>
    <invalid>
    <e/>
    </invalid>
    <invalid>
    <f/>
    </invalid>
    <invalid>
    <g/>
    </invalid>
    <invalid>
    <p>
      <d/>
      <c/>
    </p>
    </invalid>
    <invalid>
    <p>
      <d/>
      <e/>
    </p>
    </invalid>
    </testCase>
    <testCase>
    <resource name="dbk.rng">
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <ref name="p"/>
      </start>
      <define name="p.ext">
        <notAllowed/>
      </define>
      <define name="p">
        <element name="p">
          <choice>
            <ref name="p.ext"/>
    	<empty/>
            <element name="a">
              <text/>
            </element>
          </choice>
        </element>
      </define>
      <define name="c">
        <element name="c">
          <empty/>
        </element>
      </define>
    </grammar>
    </resource>
    <resource name="proof.rng">
    <grammar xmlns="http://relaxng.org/ns/structure/1.0"
             ns="http://example.org/ns/proofsystem">
      <start>
        <ref name="e"/>
      </start>
      <define name="d">
        <element name="d">
          <empty/>
        </element>
      </define>
      <define name="e">
        <element name="e">
          <empty/>
        </element>
      </define>
      <define name="f">
        <element name="f">
          <empty/>
        </element>
      </define>
    </grammar>
    </resource>
    <correct>
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <grammar>
          <include href="dbk.rng"/>
          <define name="p.ext" combine="choice">
            <choice>
    	  <ref name="c"/>
    	  <grammar>
    	    <include href="proof.rng"/>
    	    <start combine="choice">
    	      <ref name="d"/>
    	    </start>
    	  </grammar>
              <element name="b">
                <text/>
              </element>
            </choice>
          </define>
        </grammar>
      </start>
      <define name="g">
        <element name="g">
          <empty/>
        </element>
      </define>
    </grammar>
    </correct>
    <valid>
    <p/>
    </valid>
    <valid>
    <p>
      <a/>
    </p>
    </valid>
    <valid>
    <p>
      <b/>
    </p>
    </valid>
    <valid>
    <p>
      <c/>
    </p>
    </valid>
    <valid>
    <p xmlns:p="http://example.org/ns/proofsystem">
      <p:d/>
    </p>
    </valid>
    <invalid>
    <p>
      <d/>
    </p>
    </invalid>
    <valid>
    <p xmlns:p="http://example.org/ns/proofsystem">
      <p:e/>
    </p>
    </valid>
    <invalid>
    <p>
      <e/>
    </p>
    </invalid>
    <invalid>
    <p xmlns:p="http://example.org/ns/proofsystem">
      <p:f/>
    </p>
    </invalid>
    <invalid>
    <p>
      <f/>
    </p>
    </invalid>
    <invalid>
    <p>
      <g/>
    </p>
    </invalid>
    <invalid>
    <b/>
    </invalid>
    <invalid>
    <c/>
    </invalid>
    <invalid>
    <d/>
    </invalid>
    <invalid>
    <e/>
    </invalid>
    <invalid>
    <f/>
    </invalid>
    <invalid>
    <g/>
    </invalid>
    <invalid>
    <p xmlns:p="http://example.org/ns/proofsystem">
      <p:d/>
      <c/>
    </p>
    </invalid>
    <invalid>
    <p xmlns:p="http://example.org/ns/proofsystem">
      <p:d/>
      <p:e/>
    </p>
    </invalid>
    </testCase>
    <testCase>
    <resource name="ext.rng">
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <ref name="p"/>
      </start>
      <define name="p">
        <element name="p">
          <empty/>
        </element>
      </define>
    </grammar>
    </resource>
    <correct>
    <grammar xmlns="http://relaxng.org/ns/structure/1.0">
      <start>
        <element name="top">
          <choice>
            <ref name="include1"/>
            <ref name="include2"/>
          </choice>
        </element>
      </start>
      <define name="include1">
        <grammar>
          <include href="ext.rng">
            <start>
    	 <element name="a">
    	   <choice>
    	     <empty/>
    	     <ref name="p"/>
    	   </choice>
    	 </element>
    	</start>
          </include>
        </grammar>
      </define>
      <define name="include2">
        <grammar>
          <include href="ext.rng">
            <start>
    	 <element name="b">
    	   <choice>
    	     <empty/>
    	     <ref name="p"/>
    	   </choice>
    	 </element>
    	</start>
          </include>
        </grammar>
      </define>
    </grammar>
    </correct>
    <invalid>
    <top/>
    </invalid>
    <invalid>
    <a/>
    </invalid>
    <invalid>
    <b/>
    </invalid>
    <invalid>
    <p/>
    </invalid>
    <valid>
    <top>
      <a/>
    </top>
    </valid>
    <valid>
    <top>
      <b/>
    </top>
    </valid>
    <valid>
    <top>
      <a>
        <p/>
      </a>
    </top>
    </valid>
    <valid>
    <top>
      <b>
        <p/>
      </b>
    </top>
    </valid>
    </testCase>
    </testSuite>
    <testSuite>
    <documentation>Test of ID/IDREF</documentation>
    <testCase>
    <correct>
    <element name="top" xmlns="http://relaxng.org/ns/structure/1.0"
             datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
      <zeroOrMore>
        <choice>
          <element name="ref">
            <attribute name="id">
    	  <data type="ID"/>
    	</attribute>
    	<text/>
          </element>
          <element name="xref">
            <attribute name="link">
    	  <data type="IDREF"/>
    	</attribute>
    	<text/>
          </element>
        </choice>
      </zeroOrMore>
    </element>
    </correct>
    <valid>
    <top>
    </top>
    </valid>
    <invalid>
    <top>
      <xref link="id1"/>
    </top>
    </invalid>
    <valid>
    <top>
      <ref id="id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <xref link="id1"/>
      <ref id="id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <xref link="  id1 "/>
      <ref id="     id1   "/>
      <xref link="id1 "/>
      <xref link="  id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <ref id="id1"/>
      <xref link="id1"/>
    </top>
    </valid>
    <invalid>
    <top>
      <ref id="id1"/>
      <ref id="id1"/>
    </top>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element name="top" xmlns="http://relaxng.org/ns/structure/1.0"
             datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
      <zeroOrMore>
        <choice>
          <element name="ref">
            <attribute name="id">
    	  <data type="ID"/>
    	</attribute>
    	<text/>
          </element>
          <element name="xref">
            <attribute name="link">
    	  <data type="IDREFS"/>
    	</attribute>
    	<text/>
          </element>
        </choice>
      </zeroOrMore>
    </element>
    </correct>
    <valid>
    <top>
    </top>
    </valid>
    <invalid>
    <top>
      <xref link="id1"/>
    </top>
    </invalid>
    <valid>
    <top>
      <ref id="id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <xref link="id1"/>
      <ref id="id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <xref link="id1 id1"/>
      <ref id="id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <ref id="id1"/>
      <xref link="id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <ref id="id2"/>
      <xref link="id1 id2"/>
      <ref id="id1"/>
    </top>
    </valid>
    <valid>
    <top>
      <ref id="id2"/>
      <xref link=" id2    id1   id2 "/>
      <ref id="id1"/>
    </top>
    </valid>
    <invalid>
    <top>
      <ref id="id2"/>
      <xref link="id1 id2"/>
    </top>
    </invalid>
    <invalid>
    <top>
      <xref link="id1 id2"/>
      <ref id="id1"/>
    </top>
    </invalid>
    <invalid>
    <top>
      <ref id="id1"/>
      <ref id="id1"/>
    </top>
    </invalid>
    </testCase>
    </testSuite>
    <testSuite>
    <documentation>Test of ENTITY/ENTITIES</documentation>
    <testCase>
    <correct>
    <element xmlns="http://relaxng.org/ns/structure/1.0" name="doc" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
      <data type="ENTITY"/>
    </element>
    </correct>
    <invalid>
    <doc></doc>
    </invalid>
    <invalid>
    <doc>foo</doc>
    </invalid>
    <valid dtd="&#10;&lt;!DOCTYPE doc [&#10;&lt;!ENTITY foo SYSTEM 'whatever' NDATA jpeg&gt;&#10;]&gt;">
    <doc>foo</doc>
    </valid>
    <valid dtd="&#10;&lt;!DOCTYPE doc [&#10;&lt;!ENTITY foo SYSTEM 'whatever' NDATA jpeg&gt;&#10;]&gt;">
    <doc>  foo </doc>
    </valid>
    <invalid dtd="&#10;&lt;!DOCTYPE doc [&#10;&lt;!ENTITY foo SYSTEM 'whatever' NDATA jpeg&gt;&#10;]&gt;">
    <doc>foo bar</doc>
    </invalid>
    </testCase>
    <testCase>
    <correct>
    <element xmlns="http://relaxng.org/ns/structure/1.0" name="doc" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
      <data type="ENTITIES"/>
    </element>
    </correct>
    <invalid>
    <doc></doc>
    </invalid>
    <invalid>
    <doc>foo</doc>
    </invalid>
    <valid dtd="&#10;&lt;!DOCTYPE doc [&#10;&lt;!ENTITY foo SYSTEM 'whatever' NDATA jpeg&gt; &#10;&lt;!ENTITY bar SYSTEM 'whatever' NDATA jpeg&gt; &#10;]&gt;">
    <doc> foo bar </doc>
    </valid>
    <valid dtd="&#10;&lt;!DOCTYPE doc [&#10;&lt;!ENTITY foo SYSTEM 'whatever' NDATA jpeg&gt; &#10;&lt;!ENTITY bar SYSTEM 'whatever' NDATA jpeg&gt; &#10;]&gt;">
    <doc> foo bar foo</doc>
    </valid>
    <invalid dtd="&#10;&lt;!DOCTYPE doc [&#10;&lt;!ENTITY foo SYSTEM 'whatever' NDATA jpeg&gt;]&gt;">
    <doc>foo bar</doc>
    </invalid>
    </testCase>
    </testSuite>
    <testSuite>
    <documentation>Test of Mixed</documentation>
    <testCase>
    <correct>
    <element name="mix" xmlns="http://relaxng.org/ns/structure/1.0">
      <mixed>
        <zeroOrMore>
          <choice>
            <element name="a">
    	  <empty/>
    	</element>
            <element name="b">
    	  <empty/>
    	</element>
            <element name="c">
    	  <empty/>
    	</element>
          </choice>
        </zeroOrMore>
      </mixed>
      <element name="d">
        <empty/>
      </element>
    </element>
    </correct>
    <valid>
    <mix>
      <d/>
    </mix>
    </valid>
    <valid>
    <mix>
      <b/>
      <a/>
      <c/>
      <b/>
      <d/>
    </mix>
    </valid>
    <valid>
    <mix>
      mixed
      <c/>
      <d/>
    </mix>
    </valid>
    <valid>
    <mix>
      <c/>
      mixed
      <d/>
    </mix>
    </valid>
    <valid>
    <mix>
      <b/>
      is
      <a/>
      inter
      <c/>
      mixed
      <b/>
      <d/>
    </mix>
    </valid>
    <valid>
    <mix>
      mixed
      <b/>
      .
      <d/>
    </mix>
    </valid>
    <valid>
    <mix>
      this
      <b/>
      is
      <a/>
      inter
      <c/>
      mixed
      <b/>
      .
      <d/>
    </mix>
    </valid>
    </testCase>
    </testSuite>
    </testSuite>