Tuesday, June 17, 2008

XSD sample elements

Example shows how to create simple xsd elements

<xs:complexType name="PersonDetailObject">
<xs:sequence>
<xs:element name="PersonId" type="xs:string" minOccurs="0"/>
<xs:element name="Title" type="xs:string" minOccurs="0"/>
<xs:element name="FirstName" type="xs:string" minOccurs="0"/>
<xs:element name="MiddleName" type="xs:string" minOccurs="0"/>
<xs:element name="LastName" type="xs:string" minOccurs="0"/>
<xs:element name="AddressDetails" type="PersonAddressObject" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

Details of a person:-

<xs:element name="PersonRetrieve">
<xs:complexType>
<xs:sequence>
<xs:element ref="EducationInfo"/>
<xs:element name="PersonDetail" type="PersonDetailObject" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="EducationInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Degree" type="xs:string"/>
<xs:element name="University" type="xs:string"/>
<xs:element name="Specialization" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>

Search for number of persons:-

<xs:element name="PersonSearch">
<xs:complexType>
<xs:sequence>
<xs:element ref="EducationInfo"/>
<xs:element name="PersonList" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PersonSummary" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="PersonId" type="xs:string"/>
<xs:element name="LastName" type="xs:string" minOccurs="0"/>
<xs:element name="FirstName" type="xs:string" minOccurs="0"/>
<xs:element name="Email" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="TotalRecordCount" type="xs:int"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

No comments: