Home | History | Annotate | Download | only in schemas
      1 <?xml version="1.0"?>
      2 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      3 
      4   <xsd:simpleType name="codeType">
      5     <xsd:restriction base="xsd:string">
      6       <xsd:pattern value="[A-Z]+"/>
      7     </xsd:restriction>
      8   </xsd:simpleType>
      9 
     10   <xsd:element name="Test">
     11     <xsd:complexType>
     12       <xsd:sequence>
     13         <xsd:element ref="Country"
     14                      maxOccurs="unbounded"/>
     15       </xsd:sequence>
     16     </xsd:complexType>
     17   </xsd:element>
     18 
     19   <xsd:element name="Country">
     20     <xsd:complexType>
     21       <xsd:sequence>
     22         <xsd:element ref="City"
     23                      maxOccurs="unbounded"/>
     24       </xsd:sequence>
     25       <xsd:attribute name="code"
     26                      type="codeType"
     27                      use="required"/>
     28     </xsd:complexType>
     29     <xsd:key name="CountryDummyKey">
     30       <xsd:selector xpath="."/>
     31       <xsd:field xpath="@code"/>
     32     </xsd:key>
     33     <xsd:keyref name="PartRefCountryDummy"
     34       refer="CountryDummyKey">
     35       <xsd:selector xpath=".//Part"/>
     36       <xsd:field xpath="@country"/>
     37     </xsd:keyref>
     38   </xsd:element>
     39 
     40   <xsd:element name="City">
     41     <xsd:complexType>
     42       <xsd:sequence>
     43         <xsd:element ref="Part"
     44                      minOccurs="2"
     45                      maxOccurs="2"/>
     46       </xsd:sequence>
     47       <xsd:attribute name="name"
     48                      type="xsd:string"
     49                      use="required"/>
     50       <xsd:attribute name="code"
     51                      type="xsd:string"
     52                      use="required"/>
     53     </xsd:complexType>
     54   </xsd:element>
     55 
     56   <xsd:element name="Part">
     57     <xsd:complexType>
     58       <xsd:attribute name="country"
     59                     type="codeType"
     60                     use="required"/>
     61     </xsd:complexType>
     62   </xsd:element>
     63 </xsd:schema>