The XML Schema
The XML Schema below describes the purchase order. Like the basic Purchase Order example, this example is taken from the XML Schema Part 0: Primer document, section 3. The structure of this schema is identical to the structure for that of the basic example; note, however, that the targetNamespace attribute is defined on the schema element and that the elementFormDefault attribute is set to qualified. This means that all elements in an instance document of this schema are namespace-qualified.
 
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://www.example.com/PO1"
targetNamespace="http://www.example.com/PO1"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
 
<annotation>
<documentation xml:lang="en">
Purchase order schema for Example.com.
Copyright 2000 Example.com. All rights reserved.
</documentation>
</annotation>
 
<element name="purchaseOrder" type="po:PurchaseOrderType"/>
<element name="comment" type="string"/>
 
<complexType name="PurchaseOrderType">
<sequence>
<element name="shipTo" type="po:USAddress"/>
<element name="billTo" type="po:USAddress"/>
<element ref="po:comment" minOccurs="0"/>
<element name="items" type="po:Items"/>
</sequence>
<attribute name="orderDate" type="date"/>
</complexType>
...
</schema>