IT:AD:XSD

Summary

XSD formally describe elements using a schema to describe in an abstract way an object's characteristics, and relationships to other objects.

In essence, when you expose a WCF Endpoint, you are exposing a Service endpoint, that contains Operations (Methods) that accepts and returns Request and Reponse arguments. The WSDL describes the Service and its operations, and refers to separate XSD documents, used to describe the arguments.

ACiD
  • Advantages:
    • XSD has several advantages over earlier XML schema languages, such as DTD or Simple Object XML (SOX).
      • written in XML,
      • self-documentation,
      • automatic schema creation
      • ability to be queried through XML Transformations (XSLT).
  • Considerations:
  • Disadvantages:
    • the language is unnecessarily complex.

Example

<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Address">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Recipient" type="xs:string" />
        <xs:element name="House" type="xs:string" />
        <xs:element name="Street" type="xs:string" />
        <xs:element name="Town" type="xs:string" />
        <xs:element name="County" type="xs:string" minOccurs="0" />
        <xs:element name="PostCode" type="xs:string" />
        <xs:element name="Country" minOccurs="0">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="IN" />
              <xs:enumeration value="DE" />
              <xs:enumeration value="ES" />
              <xs:enumeration value="UK" />
              <xs:enumeration value="US" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>