Listing 7.1 is a trivial XML schema document that specifies only an element type whose structure type is the built-in string datatype.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="stringElement" type="xsd:string"/> </xsd:schema> |
A few features to point out about the preceding trivial schema:
The only attribute of the schema element—xmlns:xsd—specifies the namespace http://www.w3.org/2001/XMLSchema. Furthermore, the xmlns:xsd attribute specifies the corresponding namespace prefix, ‘xsd’. The specification of the XML schema namespace implies a corresponding XML schema document XMLSchema.xsd, which is the Schema for Schemas.
xmlns:xsd is not a schema attribute per se; the xmlns:xsd attribute applies to any XML element.
There is explicitly no target namespace. Note that in the subsequent example, a namespace prefix does not precede the element name ‘tokenElement’.
Given the XML schema document in Listing 7.1, the following is a valid XML instance:
<stringElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.XMLSchemaReference.com/examples/Ch07/notation.xsd >A String Value</stringElement>
Note that there is exactly one element in the XML instance: a stringElement. The value of that stringElement is ‘A String Value’.
3.22.119.251