Behold the duck.
It does not cluck.
A cluck it lacks.
It quacks.
It is especially fond
Of a puddle or pond.
When it dines or sups
It bottoms-ups.
<poem> <title>The duck</title> <author>Ogden Nash</author> <stanza> <line>Behold the duck.</line> <line>It does not cluck.</line> <line>A cluck it lacks.</line> <line>It quacks.</line> </stanza> <stanza> <line>It is especially fond</line> <line>Of a puddle or pond.</line> <line>When it dines or sups</line> <line>It bottoms-ups.</line> </stanza> </poem>
<poem> <author>Btqra Anfu</author> <stanza> <line>Orubyq gur qhpx.</line> <line>Vg qbrf abg pyhpx.</line> <line>N pyhpx vg ynpxf.</line> <line>Vg dhnpxf.</line> </stanza> <title>Gur qhpx</title> <stanza> <line>Vg vf rfcrpvnyyl sbaq</line> <line>Bs n chqqyr be cbaq.</line> <line>Jura vg qvarf be fhcf</line> <line>Vg obggbzf-hcf.</line> </stanza> </poem>
<cbrz> <gvgyr>Gur qhpx</gvgyr> <nhgube>ol Btqra Anfu</nhgube> <fgnamn> <yvar>Orubyq gur qhpx.</yvar> <yvar>Vg qbrf abg pyhpx.</yvar> <yvar>N pyhpx vg ynpxf.</yvar> <yvar>Vg dhnpxf.</yvar> </fgnamn> <fgnamn> <yvar>Vg vf rfcrpvnyyl sbaq</yvar> <yvar>Bs n chqqyr be cbaq.</yvar> <yvar>Jura vg qvarf be fhcf</yvar> <yvar>Vg obggbzf-hcf.</yvar> </fgnamn> </cbrz>
<cbrz> <gvgyr>Gur qhpx</gvgyr> <nhgube>ol Btqra Anfu</nhgube> <fgnamn> <yvar>Orubyq gur qhpx.</yvar> <yvar>Vg qbrf abg pyhpx.</yvar> <yvar>N pyhpx vg ynpxf.</yvar> <yvar>Vg dhnpxf.</yvar> </fgnamn> <fgnanm> <yyar>Vg vf rfcrpvnyyl sbaq</yyar> <yyar>Bs n chqqyr be cbaq.</yyar> <yyar>Jura vg qvarf be fhcf</yyar> <yvar>Vg obggbzf-hcf.</yvar> </fgnanm> </cbrz>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="poem"></xsd:element> <xsd:element name="title"></xsd:element> <!--* ... etc. ... *--> </xsd:schema>
<poem xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="tds03.xsd" >
| Validity | |||
|---|---|---|---|
| Validation attempted | valid | invalid | notKnown |
| full | OK. Entire subtree valid. | OK. Entire subtree assessed; error here or at some descendant. | Not possible (contradictory) |
| partial | OK. This node assessed and valid. Some descendant skipped. | OK. Problem at this node, or in a child. Also, some descendant skipped. | OK. This node not assessed (but a descendant was.) |
| none (subtree skipped) |
Not possible (contradictory) | Not possible (contradictory) | OK. This subtree was skipped. |
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="poem">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="title"/>
<xsd:element ref="author"/>
<xsd:element ref="stanza" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!--* ... etc. ... *-->
</xsd:schema>
<xsd:element name="title"> <xsd:complexType mixed="true"/> </xsd:element>or
<xsd:element name="author" type="xsd:string"/>
<xsd:complexType name="words" mixed="true"/>which allows us to say simply:
<xsd:element name="title" type="words"/> <xsd:element name="author" type="words"/> <xsd:element name="line" type="words"/>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://www.example.com/PO1"
targetNamespace="http://www.example.com/PO1"
>
<!--* declarations and definitions go here *-->
</xsd:schema>
N.B. the schema does not identify
a document-root element / start symbol.
<xsd:element name="purchaseOrder"
type="po:PurchaseOrderType"/>
<xsd:element name="comment"
type="xsd:string"/>
<xsd:element name="quantity">
<xsd:simpleType>
<xsd:restriction base="positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:complexType name="PurchaseOrderType"> <xsd:sequence> <xsd:element name="shipTo" type="po:USAddress"/> <xsd:element name="billTo" type="po:USAddress"/> <xsd:element ref="po:comment" minOccurs="0"/> <xsd:element name="items" type="po:Items"/> </xsd:sequence> <xsd:attribute name="orderDate" type="xsd:date"/> </xsd:complexType>
<xsd:element name="comment"
type="xsd:string"/>
or as mixed content:
<xsd:element name="comment"> <xsd:complexType mixed="true"> </xsd:complexType> </xsd:element>
<xsd:element name="USPrice" type="xsd:decimal"/> <xsd:attribute name="orderDate" type="xsd:date"/>
<shipDate xsi:type="xsd:date">2003-08-18</date>
<xsd:simpleType>
<xsd:restriction
base="xsd:positiveInteger">
<xsd:maxExclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="SKU">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{3}-[A-Z]{2}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType type="width-keywords"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="full"/> <xsd:enumeration value="half"/> <xsd:enumeration value="none"/> <xsd:enumeration value="default"/> </xsd:restriction> </xsd:simpleType>
<xsd:simpleType name="listofdates"> <xsd:list itemType="xsd:date"/> </xsd:simpleType>
<xsd:simpleType name="widthType">
<xsd:union
memberTypes
="width-keywords xsd:positiveInteger">
</xsd:union>
</xsd:simpleType>
<xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="street" type="xsd:string"/> <xsd:element name="city" type="xsd:string"/> <xsd:element name="state" type="xsd:string"/> <xsd:element name="zip" type="xsd:decimal"/> </xsd:sequence>
<xsd:choice> <xsd:element name="indiv" type="po:person"/> <xsd:element name="corp" type="po:organization"/> <xsd:element name="internal" type="po:dept"/> </xsd:choice>
<xsd:sequence> <xsd:choice> <xsd:element name="customer" type="po:USAddress"/> <xsd:sequence> <xsd:element name="shipTo" type="po:USAddress"/> <xsd:element name="billTo" type="po:USAddress"/> </xsd:sequence> </xsd:choice> <xsd:element ref="po:comment" minOccurs="0"/> <xsd:element name="items" type="po:Items"/> </xsd:sequence>
<xsd:attribute name="orderDate"
type="xsd:date"/>
<xsd:element name="mydoc">
<xsd:complexType>
<xsd:sequence>
<xsd:any
namespace="##any"
processContents="lax"
minOccurs="0"
maxOccurs="unbounded">
</xsd:any>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
| Validity | |||
|---|---|---|---|
| Validation attempted | valid | invalid | notKnown |
| full | OK. Entire subtree valid. | OK. Entire subtree assessed; error here or at some descendant. | Not possible (contradictory) |
| partial | OK. This node assessed and valid. Some descendant skipped. | OK. Problem at this node, or in a child. Also, some descendant skipped. | OK. This node not assessed (but a descendant was.) |
| none (subtree skipped) |
Not possible (contradictory) | Not possible (contradictory) | OK. This subtree was skipped. |
<document xmlns:p="http://www.w3.org/2001/05/PSVInfosetExtension"
xmlns="http://www.w3.org/2001/05/XMLInfoset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<children>
<element id="g1">
<namespaceName>http://www.example.com/PO1</namespaceName>
<localName>purchaseOrder</localName>
<prefix xsi:nil="true"/>
<children>
<character>
<characterCode>10</characterCode>
<elementContentWhitespace>true</elementContentWhitespace>
</character>
<character>
<characterCode>32</characterCode>
<elementContentWhitespace>true</elementContentWhitespace>
</character>
<element>
<namespaceName>http://www.example.com/PO1</namespaceName>
<localName>shipTo</localName>
<prefix xsi:nil="true"/>
<children>
...
[Examples as output from XSV and Xerces]<xsd:element name="div" type="div-type"/> <xsd:element name="div" type="div-in-form-type"/> <xsd:element name="p" type="p-type"/> <xsd:element name="p" type="p-in-form-type"/> <xsd:element name="ul" type="ul-type"/> <xsd:element name="ul" type="ul-in-form-type"/> <xsd:element name="li" type="li-type"/> <xsd:element name="li" type="li-in-form-type"/>