Page

Create Schema For Purchase Order in XML

<?xml version="1.0" encoding="iso-8859-1"?>
<xs:schema xmlns:xs="   ">
<xs:element name="shiporder">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="orderperson" type="xs:string"/>
      <xs:element name="shipto">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="address" type="xs:string"/>
                                     <xs:element name="city" type="xs:string"/>
            <xs:element name="country" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
                                    <xs:element name="email" type="xs:email"/>
                                                <xs:sequence>
                                                             <xs:element name="to" type="xs:string"/>
                                                                        <xs:simpleType>
                                                                                     <xs:restriction base="xs:string">
                                                                                     <xs:pattern value="{[a-zA-Z0-9]}+[@]{[a-zA-Z]}+[.][com|in|org]">
                                                                         </xs:pattern>
                                                             </xs:restriction>
                                                 </xs:simpleType>
                                     </xs:sequence>
                                     
          
      <xs:element name="item" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="title" type="xs:string"/>
            <xs:element name="note" type="xs:string" minOccurs="0"/>
            <xs:element name="quantity" type="xs:positiveInteger"/>
            <xs:element name="price" type="xs:decimal"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="orderid" type="xs:string" use="required"/>
  </xs:complexType>
</xs:element>

</xs:schema>


No comments:

Post a Comment