<root>
<child>
<subchild>.....</subchild>
</child>
</root>
Ο σκοπός της XSD είναι ο καθορισμός:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="shipOrder" type="order"/>
<xsd:complexType name="order">
<xsd:sequence>
<xsd:element name="shipTo" type="shipAddress"/>
<xsd:element name="items" type="cdItems"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="shipAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="address" type="xsd:string"/>
<xsd:element name="country" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="cdItems">
<xsd:sequence>
<xsd:element name="item" type="cdItem"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="cdItem">
<xsd:sequence>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="quantity" type="xsd:integer"/>
<xsd:element name="price" type="xsd:decimal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
<shipOrder xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
<shipTo>
<name>Joe Doe</name>
<street>There 2</street>
<address>4000 RigthHere</address>
<country>Wonderland</country>
</shipTo>
<items>
<item>
<title>Java Intro</title>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Advanced Java</title>
<quantity>1</quantity>
<price>19.90</price>
</item>
</items>
</shipOrder>
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:element name="oblivial">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="chalcone" type="xsd:string"/>
<xsd:element name="casearia" minOccurs="2" maxOccurs="5">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="deplored" type="xsd:string"
use="required"/>
<xsd:attribute name="riccia" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="utf-8" ?>
<oblivial>
<chalcone>exeter</chalcone>
<casearia deplored="ferfer" riccia="fwfwfe">emfer</casearia>
<casearia deplored="grbr" riccia="oemvokemv">fergr</casearia>
</oblivial>