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