Let’s now roll back time and, from the outset of our service’s lifetime, specify a forwards-compatible, extensible schema:
<?xml version=”1.0” encoding=”utf-8”?>
<xs:schema xmlns=”urn:example.com:productsearch:products”
xmlns:xs=”http://www.w3.org/2001/XMLSchema”
elementFormDefault=”qualified”
targetNamespace=”urn:example.com:productsearch:products”
id=”Products”>
<xs:element name=”Products” type=”Products” />
<xs:complexType name=”Products”>
<xs:sequence>
<xs:element minOccurs=”0” maxOccurs=”unbounded” name=”Product” type=”Product” />
</xs:sequence>
</xs:complexType>
<xs:complexType name=”Product”>
<xs:sequence>
<xs:element name=”CatalogueID” type=”xs:int” />
<xs:element name=”Name” type=”xs:string” />
<xs:element name=”Price” type=”xs:double” />
<xs:element name=”Manufacturer” type=”xs:string” />
<xs:element name=”InStock” type=”xs:string” />
<xs:element minOccurs=”0” maxOccurs=”1” name=”Extension” type=”Extension” />
</xs:sequence>
</xs:complexType>
<xs:complexType name=”Extension”>
<xs:sequence>
<xs:any minOccurs=”1” maxOccurs=”unbounded” namespace=”##targetNamespace” processContents=”lax” />
</xs:sequence>
</xs:complexType>
</xs:schema>
This schema includes an optional Extension element at the foot of each product. The extension element itself can contain one or more elements from the target namespace: