Name
xs:anyURI — URI (Uniform Resource Identifier).
Derived from:
xs:anySimpleType
Primary:
xs:anyURI
Known subtypes:
none
Facets:
xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
<xs:simpleType name="anyURI" id="anyURI"> <xs:restriction base="xs:anySimpleType"> <xs:whiteSpace value="collapse" fixed="true"/> </xs:restriction></xs:simpleType>
Description
This datatype corresponds normatively to the XLink
href
attribute. Its value space includes the URIs
defined by the RFCs 2396 and 2732, but its lexical space
doesn’t require the character escapes needed to
include non-ASCII characters in URIs.
Restrictions
Relative URIs are not “absolutized” by W3C XML Schema. A datatype defined as:
<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 Part 2: Datatypes </a>
The Recommendation states that “it is impractical for processors to check that a value is a context-appropriate URI reference,” freeing schema processors from having to validate the correctness of the URI.
Example
<xs:simpleType name="httpURI"> <xs:restriction base="xs:anyURI"> <xs:pattern value="http://.*"/> </xs:restriction> </xs:simpleType> ...
Get XML Schema now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.