summaryrefslogtreecommitdiffstats
path: root/testSuite.rng
blob: 6626f3adf05736b45eabb6789c4bb4b6305da423 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?xml version="1.0"?>
<!-- $Id: testSuite.rng,v 1.10 2002/04/30 07:00:05 jjc Exp $ -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0" ns="">
  <!--
    Target namespace is intentionally set to "" so as not to interfere with
    prefix/URI bindings
  -->
  
  <start>
    <ref name="testSuite"/>
  </start>

  <define name="testSuite">
    <element name="testSuite">
      <ref name="header"/>
      <zeroOrMore>
        <choice>
           <ref name="testSuite"/>
           <ref name="testCase"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>

  <define name="testCase">
    <element name="testCase">
      <ref name="header"/>
      
      <ref name="resources"/>

      <choice>
       
        <!-- Incorrect schema -->
        <element name="incorrect">
          <ref name="dtd"/>
          <ref name="anyElement"/>
        </element>
         
        <!-- Correct schema and test cases -->
        <group>
          <element name="correct">
            <ref name="dtd"/>
            <externalRef href="relaxng.rng"/>
          </element>
          <zeroOrMore>
            <choice>
              <!-- Valid test cases -->
              <element name="valid">
                <ref name="dtd"/>
                <ref name="anyElement"/>
              </element>
              <!-- Invalid test cases -->
              <element name="invalid">
                <ref name="dtd"/>
                <ref name="anyElement"/>
              </element>
            </choice>
          </zeroOrMore>
        </group>

      </choice>

    </element>
  </define>

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

  <define name="anyElement">
    <element>
      <anyName/>
      <ref name="any"/>
    </element>
  </define>

  <define name="header">
    <zeroOrMore>
      <choice>
        <element name="title">
          <text/>
        </element>
	<element name="documentation">
	  <text/>
	</element>
	<element name="author">
	  <text/>
	</element>
        <!-- Email address for correspondence about test cases. -->
	<element name="email">
	  <text/>
	</element>
        <!-- Section of the specification being tested. -->
        <element name="section">
          <text/>
        </element>
        <element name="requires">
          <attribute name="datatypeLibrary"/>
        </element>
        <element>
          <anyName>
            <except>
              <nsName/>
            </except>
          </anyName>
          <ref name="any"/>
        </element>
      </choice>
    </zeroOrMore>
  </define>

  <define name="resources">
    <zeroOrMore>
      <choice>
	<element name="resource">
	  <attribute name="name">
            <ref name="pathSegment"/>
          </attribute>
          <ref name="dtd"/>
	  <ref name="anyElement"/>
	</element>
        <element name="dir">
          <attribute name="name">
            <ref name="pathSegment"/>
          </attribute>
          <ref name="resources"/>
        </element>
      </choice>
    </zeroOrMore>
  </define>

  <define name="dtd">
    <optional>
      <attribute name="dtd"/>
    </optional>
  </define>
 
  <!-- A relative URI segment. -->

  <define name="pathSegment">
    <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
          type="string">
      <!-- one or more RFC 2396 pchars -->
      <param name="pattern">([\-A-Za-z0-9:@&amp;=+$,_.!~*'()]|%[0-9a-fA-F][0-9a-fA-F])+</param>
    </data>
  </define>
  
</grammar>