Home | History | Annotate | Download | only in schemas
      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 <!-- attributeGroup replaces individual declarations -->
     26       <xsd:attributeGroup ref="ItemDelivery"/>
     27     </xsd:complexType>
     28   </xsd:element>
     29   <xsd:attributeGroup name="ItemDelivery">
     30     <xsd:attribute name="partNum" type="SKU" use="required"/>
     31     <xsd:attribute name="weightKg" type="xsd:decimal"/>
     32     <xsd:attribute name="shipBy">
     33       <xsd:simpleType>
     34         <xsd:restriction base="xsd:string">
     35           <xsd:enumeration value="air"/>
     36           <xsd:enumeration value="land"/>
     37           <xsd:enumeration value="any"/>
     38         </xsd:restriction>
     39       </xsd:simpleType>
     40     </xsd:attribute>
     41   </xsd:attributeGroup>
     42 </xsd:schema>
     43