Uniform Resource Identifiers (URIs) are used to uniquely identify resources, and they may be absolute or relative. Absolute URIs provide the entire context for identifying the resources, such as http://datypic.com/prod.html. Relative URI references are specified as the difference from a base URI, such as
../prod.html. A URI reference may also contain a fragment identifier following the
# character, such as
The three previous examples happen to be HTTP Uniform Resource Locators (URLs), but URIs also encompass URLs of other schemes (e.g., FTP, gopher, telnet), as well as Uniform Resource Names (URNs). URIs are not required to be dereferenceable; that is, it is not necessary for there to be a web page or other resource at http://datypic.com/prod.html in order for this to be a valid URI. Sometimes URIs just serve as names. For example, in XQuery, URIs are used as the names of namespaces and collations.
The built-in type
represents a URI reference. Most XQuery functions that accept URIs as arguments call for
xs:string values instead, but an
xs:anyURI value is acceptable also. This is because of a special type-promotion rule that allows
xs:anyURI values to be automatically promoted to
xs:string when a string is expected. Most of the URI-related functions return
xs:anyURI values, following the philosophy of being liberal in what they accept and specific in what they produce.
Relative URIs are interpreted ...