Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0231cf3e4234bf25d7e4fb843403e5079b024808 (plain) (blame)
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
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:cat="http://www.example.com/catalog" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.example.com/catalog">

<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>

<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.cs.rpi.edu/~puninj/XGMML/xlinks-2001.xsd"/>

<xs:element name="catalog">
  <xs:complexType>
    <xs:sequence>
      <xs:element maxOccurs="unbounded" ref="cat:_item"/>
    </xs:sequence>
    <xs:attribute fixed="0.1" name="version" type="xs:string" use="required"/>
    <xs:attribute ref="xml:base"/>
    <xs:attribute ref="xml:lang"/>
  </xs:complexType>
</xs:element>

<xs:element abstract="true" name="_item" type="cat:itemType"/>

<xs:complexType name="itemType">
  <xs:sequence>
    <xs:element name="title" type="xs:token"/>
    <xs:element name="description" nillable="true" type="cat:description"/>
    <xs:element maxOccurs="unbounded" name="price" type="cat:price"/>
  </xs:sequence>
  <xs:attribute name="label" type="xs:token"/>
  <xs:attribute name="code" type="xs:ID" use="required"/>
  <xs:attributeGroup ref="xlink:simpleLink"/>
</xs:complexType>

<xs:element name="tshirt" substitutionGroup="cat:_item" type="cat:tshirtType"/>

<xs:complexType name="tshirtType">
  <xs:complexContent>
    <xs:extension base="cat:itemType">
      <xs:attribute name="sizes" type="cat:clothesSizes" use="required"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:simpleType name="clothesSizes">
  <xs:union memberTypes="cat:sizeList">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="oneSize"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:union>
</xs:simpleType>

<xs:simpleType name="sizeList">
  <xs:restriction>
    <xs:simpleType>
      <xs:list itemType="cat:clothesSize"/>
    </xs:simpleType>
    <xs:minLength value="1"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="clothesSize">
  <xs:union memberTypes="cat:numberedSize cat:categorySize"/>
</xs:simpleType>

<xs:simpleType name="numberedSize">
  <xs:restriction base="xs:integer">
    <xs:enumeration value="4"/>
    <xs:enumeration value="6"/>
    <xs:enumeration value="8"/>
    <xs:enumeration value="10"/>
    <xs:enumeration value="12"/>
    <xs:enumeration value="14"/>
    <xs:enumeration value="16"/>
    <xs:enumeration value="18"/>
    <xs:enumeration value="20"/>
    <xs:enumeration value="22"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="categorySize">
  <xs:restriction base="xs:token">
    <xs:enumeration value="XS"/>
    <xs:enumeration value="S"/>
    <xs:enumeration value="M"/>
    <xs:enumeration value="L"/>
    <xs:enumeration value="XL"/>
    <xs:enumeration value="XXL"/>
  </xs:restriction>
</xs:simpleType>

<xs:element name="album" substitutionGroup="cat:_item" type="cat:albumType"/>

<xs:complexType name="albumType">
  <xs:complexContent>
    <xs:extension base="cat:itemType">
      <xs:sequence>
        <xs:element name="artist" type="xs:string"/>
      </xs:sequence>
      <xs:attribute name="formats" type="cat:formatsType" use="required"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:simpleType name="formatsType">
  <xs:list itemType="cat:formatType"/>
</xs:simpleType>

<xs:simpleType name="formatType">
  <xs:restriction base="xs:token">
    <xs:enumeration value="CD"/>
    <xs:enumeration value="MiniDisc"/>
    <xs:enumeration value="tape"/>
    <xs:enumeration value="vinyl"/>
  </xs:restriction>
</xs:simpleType>

<xs:complexType mixed="true" name="description">
  <xs:sequence>
    <xs:any maxOccurs="unbounded" minOccurs="0" namespace="http://www.w3.org/1999/xhtml" processContents="lax"/>
  </xs:sequence>
  <xs:attribute ref="xml:lang"/>
</xs:complexType>

<xs:complexType name="price">
  <xs:simpleContent>
    <xs:extension base="cat:monetaryAmount">
      <xs:attribute default="USD" name="currency" type="cat:currencyType"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="currencyType">
  <xs:restriction base="xs:token">
    <xs:pattern value="[A-Z]{3}"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="monetaryAmount">
  <xs:restriction base="xs:decimal">
    <xs:fractionDigits value="3"/>
    <xs:pattern value="\d+\.(\d{2})?"/>
  </xs:restriction>
</xs:simpleType>

</xs:schema>

Back to the top