Simple Person Schema

Code

<xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:domain="http://www.company.com/domain"
  targetNamespace="http://www.company.com/domain"
  elementFormDefault="unqualified"
  attributeFormDefault="unqualified">
 
   <xsd:element name="Person" type="domain:Person">
   </xsd:element>
 
   <xsd:complexType name="Person">
      <xsd:all>
         <xsd:element name="Name" type="xsd:string" nillable="false" minOccurs="1" maxOccurs="1"/>
         <xsd:element name="Address" type="domain:Address" nillable="false" />
         <xsd:element name="Sex" type="domain:Sex" nillable="false" />
         <xsd:element name ="Pets" minOccurs="0" maxOccurs="1">
            <xsd:complexType>
               <xsd:sequence>
                  <xsd:element name="Pet" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
               </xsd:sequence>
            </xsd:complexType>
         </xsd:element>
      </xsd:all>
   </xsd:complexType>
 
   <xsd:complexType name="Address">
      <xsd:all>
         <xsd:element name="Street" type="xsd:string" nillable="false" />
         <xsd:element name="City" type="xsd:string" nillable="false" />
         <xsd:element name="Zip" type="xsd:string" nillable="false" />
         <xsd:element name="State" type="xsd:string" nillable="false" />
      </xsd:all>
   </xsd:complexType>
 
   <xsd:simpleType name="Sex">
      <xsd:restriction base="xsd:string">
         <xsd:enumeration value="Male" />
         <xsd:enumeration value="Female" />
      </xsd:restriction>
   </xsd:simpleType>
</xsd:schema>

Commentary

This is just a very simple schema based on a person entity for demonstration purposes.

Snippet Usage

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.