Name

xsd:anyURI — URI (Uniform Resource Identifier)

Synopsis

<xsd:simpleType name="anyURI” id="anyURI">
 <xsd:restriction base="xsd:anySimpleType">
 <xsd:whiteSpace value="collapse” fixed="true"/>
 </xsd:restriction></xsd:simpleType>

Derived from

xsd:anySimpleType

Primary

xsd:anyURI

Known subtypes

None

Data parameters (facets)

enumeration, length, maxLength, minLength, pattern

Description

This datatype corresponds normatively to the XLink href attribute. Its value space includes the URIs defined by RFCs 2396 and 2732, but its lexical space doesn’t require the character escapes needed to include non-ASCII characters in a URIs.

Restrictions

Relative URIs aren’t absolutized by the W3C XML Schema. A pattern defined as:

<data type="xsd:anyURI">
  <choice">
    <value type="xsd:anyURI">http://www.w3.org/TR/xmlschema-0/</value>
    <value type="xsd:anyURI">http://www.w3.org/TR/xmlschema-1/</value>
    <value type="xsd:anyURI">http://www.w3.org/TR/xmlschema-2/</value>
  </choice> 
</data>

shouldn’t match 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,” thus freeing schema processors from having to validate the correctness of the URI.

Example

<define name="httpURI">
  <data type="xsd:anyURI">
    <param name="pattern">http://.*<param>
  </data>
</define>

Get RELAX NG 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.