XML technologies / XML Schema / Data type reference / xs:anyURI
(Excerpt from “XML Schema” by Eric van der Vlist)
URI (Uniform Resource Identifier)
Derived from: xs:anySimpleType
Primitive type: xs:anyURI
Known subtypes: none
Facets: xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
Definition
<xs:simpleType name="anyURI" id="anyURI">
<xs:restriction base="xs:anySimpleType">
<xs:whiteSpace value="collapse" fixed="true"/>
</xs:restriction>
</xs:simpleType>Description
This data type corresponds normatively to the href attribute of XLink. Its value space contains URIs as defined by RFCs 2396 and 2732, but its lexical space does not require the escaping normally needed for non-ASCII URI characters.
Restrictions
Relative URIs are not made absolute by W3C XML Schema. A data type defined as follows:
<xs:simpleType name="schemaRecommendations">
<xs:restriction base="xs:anyURI">
<xs:enumeration value="http://www.w3.org/TR/xmlschema-0/"/>
<xs:enumeration value="http://www.w3.org/TR/xmlschema-1/"/>
<xs:enumeration value="http://www.w3.org/TR/xmlschema-2/"/>
</xs:restriction>
</xs:simpleType> should not validate the href attribute in this instance element:
<a xml:base="http://www.w3.org/TR/" href="xmlschema-1/">XML Schema Teil 2: Datentypen</a>The recommendation says that processors cannot practically check whether a value is an appropriate URI reference for its context. Schema processors are therefore not required to validate URI correctness.
Example
<xs:simpleType name="httpURI">
<xs:restriction base="xs:anyURI">
<xs:pattern value="http://.*"/>
</xs:restriction>
</xs:simpleType>
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de