File: test.xsd

package info (click to toggle)
libxmlada 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,212 kB
  • sloc: ada: 78,068; sh: 3,310; makefile: 394; xml: 111; python: 39
file content (169 lines) | stat: -rw-r--r-- 4,817 bytes parent folder | download | duplicates (7)
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
158
159
160
161
162
163
164
165
166
167
168
169
<?xml version="1.0" ?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:test2="http://test2"
            xsi:schemaLocation="http://test2 test2.xsd"
       >
<xsd:element name="root">
 <xsd:complexType>
  <xsd:sequence>
    <xsd:group ref="toplevel"/>
    <xsd:sequence>
      <xsd:element ref="strs" maxOccurs="2"/>
    </xsd:sequence>
    <xsd:element ref="person" minOccurs="0" maxOccurs="unbounded"/>

    <!--  The following would be non-determinist
    <xsd:any namespace="##local" processContents="lax"
       minOccurs="0" maxOccurs="unbounded"/>
    -->
    <xsd:element ref="test2:manu"/>
    <xsd:any namespace="##other" processContents="lax"
       minOccurs="0" maxOccurs="unbounded"/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:group name="toplevel">
 <xsd:sequence>
  <xsd:element ref="my_string" />
  <xsd:element ref="zip"  maxOccurs="3" />
  <xsd:element ref="zipb" maxOccurs="3" />
  <xsd:element ref="zipr" maxOccurs="3" />
  <xsd:element ref="strs"/>
 </xsd:sequence>
</xsd:group>

<xsd:attributeGroup name="Tzip_attrs">
 <!--<xsd:attribute name="attr2" type="xsd:boolean" use="default" value="true"/>
 -->
 <xsd:attribute name="attr3">
    <xsd:simpleType>
       <xsd:list itemType="xsd:int"/>
    </xsd:simpleType>
 </xsd:attribute>
 <xsd:attribute name="attr4" use="optional">
    <xsd:simpleType>
       <xsd:restriction base="xsd:NMTOKEN">
          <xsd:enumeration value="value1"/>
          <xsd:enumeration value="value2"/>
       </xsd:restriction>
    </xsd:simpleType>
 </xsd:attribute>
</xsd:attributeGroup>

<xsd:complexType name="Tzip">
 <xsd:complexContent>
   <xsd:extension base="Tzip_base">
     <xsd:sequence>
        <xsd:element name="foo" type="xsd:string"/>
     </xsd:sequence>
     <xsd:attributeGroup ref="Tzip_attrs"/>
   </xsd:extension>
 </xsd:complexContent>
</xsd:complexType>
<xsd:element name="zip" type="Tzip" />

<xsd:complexType name="Tzip_restr">
 <xsd:complexContent>
    <xsd:restriction base="Tzip_base">
       <xsd:choice>
          <xsd:element name="zipcode" type="xsd:string"/>
       </xsd:choice>
    </xsd:restriction>
 </xsd:complexContent>
</xsd:complexType>
<xsd:element name="zipr" type="Tzip_restr"/>

<xsd:complexType name="Tzip_base">
 <xsd:sequence>
  <xsd:choice>
   <xsd:element name="zipcode" type="xsd:string" maxOccurs="2"/>
   <xsd:element name="code_postal" type="xsd:string"/>
  </xsd:choice>
 </xsd:sequence>
 <xsd:attribute name="attr1" use="optional">
    <xsd:simpleType>
       <xsd:union memberTypes="xsd:time myRange"/>
    </xsd:simpleType>
 </xsd:attribute>
</xsd:complexType>
<xsd:element name="zipb" type="Tzip_base" />

<xsd:simpleType name="myRange">
   <xsd:restriction base="myRange2">
      <xsd:maxInclusive value="-11"/>
   </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="myRange2">
   <xsd:restriction base="xsd:nonPositiveInteger">
   </xsd:restriction>
</xsd:simpleType>

<xsd:element name="my_string" type="AdaString" />
<xsd:complexType name="AdaString">
 <xsd:sequence>
  <xsd:element name="size"     type="xsd:nonNegativeInteger"/>
  <xsd:element name="contents" type="xsd:string" />
 </xsd:sequence>
</xsd:complexType>

<xsd:element name="stdstring" type="xsd:string" />

<!-- Ambigous:
  Error at file /home/briot/Ada/xml/xmlada/schema/test/test.xml, line 4, char 49
  Message: 'str' and 'str' violate the Unique Particle Attribution rule
  -->
<!--
<xsd:complexType name="ambiguous">
 <xsd:choice>
  <xsd:sequence>
    <xsd:element name="str" type="xsd:string"/>
    <xsd:element name="str2" type="xsd:string"/>
  </xsd:sequence>
  <xsd:element name="str" type="xsd:string"/>
 </xsd:choice>
</xsd:complexType>
-->

<!-- Valid, since sequence doesn't mix with "str" -->

<xsd:complexType name="Tstrs">
 <xsd:sequence>
  <xsd:sequence>
   <xsd:element name="str" type="xsd:string"/>
   <xsd:element name="str2" type="xsd:string"/>
  </xsd:sequence>
  <xsd:element name="str" type="xsd:string"/>
 </xsd:sequence>
</xsd:complexType>
<xsd:element name="strs" type="Tstrs" />

<xsd:element name="person">
  <xsd:complexType>
    <xsd:all minOccurs="0">
      <xsd:element name="first_name" type="xsd:string"/>
      <xsd:element name="last_name" type="xsd:string" minOccurs="0"/>
    </xsd:all>
  </xsd:complexType>
</xsd:element>

<!-- Ambiguous2:
  Error at file /home/briot/Ada/xml/xmlada/schema/test/test.xml, line 4, char 49
  Message: 'str' and 'str' violate the Unique Particle Attribution rule -->

<!--
<xsd:complexType name="ambiguous2">
 <xsd:choice>
  <xsd:choice>
   <xsd:element name="str2" type="xsd:string"/>
   <xsd:element name="str" type="xsd:string"/>
  </xsd:choice>
  <xsd:element name="str" type="xsd:string"/>
 </xsd:choice>
</xsd:complexType>
-->

</xsd:schema>