/ libxml2 / test / schemas / po0_0.xsd
po0_0.xsd
 1  <?xml version="1.0"?>
 2  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 3    <xsd:annotation>
 4      <xsd:documentation xml:lang="en">
 5  Purchase order schema for Example.com.
 6     Copyright 2000 Example.com. All rights reserved.
 7      </xsd:documentation>
 8    </xsd:annotation>
 9    <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
10    <xsd:element name="comment" type="xsd:string"/>
11    <xsd:complexType name="PurchaseOrderType">
12      <xsd:sequence>
13        <xsd:element name="shipTo" type="USAddress"/>
14        <xsd:element name="billTo" type="USAddress"/>
15        <xsd:element ref="comment" minOccurs="0"/>
16        <xsd:element name="items" type="Items"/>
17      </xsd:sequence>
18      <xsd:attribute name="orderDate" type="xsd:date"/>
19    </xsd:complexType>
20    <xsd:complexType name="USAddress">
21      <xsd:sequence>
22        <xsd:element name="name" type="xsd:string"/>
23        <xsd:element name="street" type="xsd:string"/>
24        <xsd:element name="city" type="xsd:string"/>
25        <xsd:element name="state" type="xsd:string"/>
26        <xsd:element name="zip" type="xsd:decimal"/>
27      </xsd:sequence>
28      <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
29    </xsd:complexType>
30    <xsd:complexType name="Items">
31      <xsd:sequence>
32        <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
33          <xsd:complexType>
34            <xsd:sequence>
35              <xsd:element name="productName" type="xsd:string"/>
36              <xsd:element name="quantity">
37                <xsd:simpleType>
38                  <xsd:restriction base="xsd:positiveInteger">
39                    <xsd:maxExclusive value="100"/>
40                  </xsd:restriction>
41                </xsd:simpleType>
42              </xsd:element>
43              <xsd:element name="USPrice" type="xsd:decimal"/>
44              <xsd:element ref="comment" minOccurs="0"/>
45              <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
46            </xsd:sequence>
47            <xsd:attribute name="partNum" type="SKU" use="required"/>
48          </xsd:complexType>
49        </xsd:element>
50      </xsd:sequence>
51    </xsd:complexType>
52  <!-- Stock Keeping Unit, a code for identifying products -->
53    <xsd:simpleType name="SKU">
54      <xsd:restriction base="xsd:string">
55        <xsd:pattern value="\d{3}-[A-Z]{2}"/>
56      </xsd:restriction>
57    </xsd:simpleType>
58  </xsd:schema>
59