3abe9331 |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" |
3 | xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
51fa56b9 |
4 | xmlns:subs="www.example.org/substitutiongroup" |
3abe9331 |
5 | targetNamespace="www.example.org/substitutiongroup"> |
6 | |
7 | <!-- THE HEAD ELEMENT --> |
8 | <xsd:element name="head" type="xsd:string" /> |
9 | |
10 | <!-- SUBSTITUTION ELEMENT OF THE SAME TYPE AS THE HEAD --> |
51fa56b9 |
11 | <xsd:element name="member1" type="xsd:string" substitutionGroup="subs:head"/> |
3abe9331 |
12 | |
13 | <!-- SUBSTITUTION ELEMENT OF A TYPE RESTRICTING THE TYPE OF THE HEAD --> |
14 | <xsd:simpleType name="stringEnum"> |
15 | <xsd:restriction base="xsd:string"> |
16 | <xsd:enumeration value="something"/> |
17 | <xsd:enumeration value="else"/> |
18 | </xsd:restriction> |
19 | </xsd:simpleType> |
20 | |
51fa56b9 |
21 | <xsd:element name="member2" type="subs:stringEnum" substitutionGroup="subs:head"/> |
3abe9331 |
22 | |
23 | <!-- SUBSTITUTION ELEMENT OF A TYPE EXTENDING THE TYPE OF THE HEAD --> |
24 | <xsd:complexType name="complexEnum"> |
25 | <xsd:simpleContent> |
26 | <xsd:extension base="xsd:string"> |
27 | <xsd:attribute name="foo" type="xsd:float"/> |
28 | <xsd:attribute name="bar" type="xsd:integer"/> |
29 | </xsd:extension> |
30 | </xsd:simpleContent> |
31 | </xsd:complexType> |
32 | |
51fa56b9 |
33 | <xsd:element name="member3" type="subs:complexEnum" substitutionGroup="subs:head"/> |
3abe9331 |
34 | |
35 | <!-- TOP LEVEL ELEMENT TO DEMONSTRATE SUBSTITUTION --> |
36 | <xsd:element name="ize"> |
37 | <xsd:complexType> |
38 | <xsd:sequence> |
51fa56b9 |
39 | <xsd:element ref="subs:head" minOccurs="0" maxOccurs="unbounded"/> |
3abe9331 |
40 | </xsd:sequence> |
41 | </xsd:complexType> |
42 | </xsd:element> |
43 | |
44 | </xsd:schema> |