1.1. XML Schema

XML Schema is a World Wide Web Consortium (W3C) standard for defining the structure and content of Extensible Markup Language (XML) documents. In short, this means that you can define how an XML document should look and what types any data in it should conform to; it is a form of data contract, if you like. BizTalk is driven by messages, which, in most cases, are based on an XML schema that must be deployed to BizTalk.

The following is an example of a simple schema used to describe a person:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Person">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Name" type="xs:string"/>
        <xs:element name="Age" type="xs:int"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

This schema defines an element called Person that contains a complex type, which, in its simplest form, is a collection of subelements (like a class in object-oriented programming). Two further elements with differing data types have been defined within this complex type.

The following is the XML document that conforms to this schema:

<Person>
  <Name>Lucy</Name>
  <Age>5</Age>
</Person>

Defining the schema in this way enables you to enforce how you expect data to be encoded or represented. This schema can be given to any consumers of your application to ensure that they respect this contract and it enables them to communicate with you easily.

You can also use the schema to validate any incoming XML documents, which can eliminate ...

Get Professional BizTalk® Server 2006 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.