Compact syntax parsing fixes
[cxml-rng.git] / compatibility.rng
bloba9e426366756382eed87cd14f5f97cb04911fcf3
1 <grammar xmlns="http://relaxng.org/ns/structure/1.0"
2   xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
3   xmlns:rng="http://relaxng.org/ns/structure/1.0">
5   <start>
6     <choice>
7       <ref name="normal"/>
8       <ref name="attribute"/>
9       <ref name="atomic"/>
10     </choice>
11   </start>
13   <define name="normal">
14     <element>
15       <nsName ns="http://relaxng.org/ns/structure/1.0">
16         <except>
17           <name>rng:attribute</name>
18           <name>rng:value</name>
19           <name>rng:param</name>
20           <name>rng:name</name>
21         </except>
22       </nsName>
23       <ref name="normalAtts"/>
24       <ref name="normalContent"/>
25     </element>
26   </define>
28   <define name="attribute">
29     <element name="rng:attribute">
30       <ref name="normalAtts"/>
31       <optional>
32         <attribute name="a:defaultValue">
33           <text/>
34         </attribute>
35       </optional>
36       <ref name="normalContent"/>
37     </element>
38   </define>
40   <define name="atomic">
41     <element>
42       <choice>
43         <name>rng:value</name>
44         <name>rng:param</name>
45         <name>rng:name</name>
46       </choice>
47       <ref name="normalAtts"/>
48       <text/>
49     </element>
50   </define>
52   <define name="normalAtts">
53     <zeroOrMore>
54       <attribute>
55         <anyName>
56           <except>
57             <nsName ns="http://relaxng.org/ns/compatibility/annotations/1.0"/>
58           </except>
59         </anyName>
60         <text/>
61       </attribute>
62     </zeroOrMore>
63   </define>
65   <define name="normalContent">
66     <interleave>
67       <zeroOrMore>
68         <ref name="foreign"/>
69       </zeroOrMore>
70       <group>
71         <zeroOrMore>
72           <ref name="doc"/>
73         </zeroOrMore>
74         <zeroOrMore>
75           <choice>
76             <group>
77               <ref name="atomic"/>
78               <zeroOrMore>
79                 <ref name="doc"/>
80               </zeroOrMore>
81             </group>
82             <ref name="attribute"/>
83             <ref name="normal"/>
84           </choice>
85         </zeroOrMore>
86       </group>
87     </interleave>
88   </define>
90   <define name="foreign">
91     <element>
92       <anyName>
93         <except>
94           <nsName ns="http://relaxng.org/ns/structure/1.0"/>
95           <nsName ns="http://relaxng.org/ns/compatibility/annotations/1.0"/>
96         </except>
97       </anyName>
98       <ref name="any"/>
99     </element>
100   </define>
102   <define name="any">
103     <zeroOrMore>
104       <choice>
105         <attribute>
106           <anyName/>
107           <text/>
108         </attribute>
109         <element>
110           <anyName/>
111           <ref name="any"/>
112         </element>
113         <text/>
114       </choice>
115     </zeroOrMore>
116   </define>
118   <define name="doc">
119     <element name="a:documentation">
120       <zeroOrMore>
121         <attribute>
122           <anyName>
123             <except>
124               <nsName ns="http://relaxng.org/ns/structure/1.0"/>
125               <nsName ns="http://relaxng.org/ns/compatibility/annotations/1.0"/>
126               <nsName ns=""/>
127             </except>
128           </anyName>
129           <text/>
130         </attribute>
131       </zeroOrMore>
132       <text/>
133     </element>
134   </define>
136 </grammar>