/ libxml2 / test / schemas / item_0.xsd
item_0.xsd
 1  <?xml version="1.0"?>
 2  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 3    <xsd:element name="comment" type="xsd:string"/>
 4    <!-- Stock Keeping Unit, a code for identifying products -->
 5    <xsd:simpleType name="SKU">
 6      <xsd:restriction base="xsd:string">
 7        <xsd:pattern value="\d{3}-[A-Z]{2}"/>
 8      </xsd:restriction>
 9    </xsd:simpleType>
10    <xsd:element name="Item">
11      <xsd:complexType>
12        <xsd:sequence>
13          <xsd:element name="productName" type="xsd:string"/>
14          <xsd:element name="quantity">
15            <xsd:simpleType>
16              <xsd:restriction base="xsd:positiveInteger">
17                <xsd:maxExclusive value="100"/>
18              </xsd:restriction>
19            </xsd:simpleType>
20          </xsd:element>
21          <xsd:element name="USPrice" type="xsd:decimal"/>
22          <xsd:element ref="comment" minOccurs="0"/>
23          <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
24        </xsd:sequence>
25        <xsd:attribute name="partNum" type="SKU" use="required"/>
26        <!-- add weightKg and shipBy attributes -->
27        <xsd:attribute name="weightKg" type="xsd:decimal"/>
28        <xsd:attribute name="shipBy">
29          <xsd:simpleType>
30            <xsd:restriction base="xsd:string">
31              <xsd:enumeration value="air"/>
32              <xsd:enumeration value="land"/>
33              <xsd:enumeration value="any"/>
34            </xsd:restriction>
35          </xsd:simpleType>
36        </xsd:attribute>
37      </xsd:complexType>
38    </xsd:element>
39  </xsd:schema>