Skip to Content
XQuery
book

XQuery

by Priscilla Walmsley
March 2007
Intermediate to advanced content levelIntermediate to advanced
512 pages
21h 15m
English
O'Reilly Media, Inc.
Content preview from XQuery

Working with URIs

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 ../prod.html#shirt.

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 xs:anyURI 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.

Base and Relative URIs

Relative URIs are interpreted ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XQuery, 2nd Edition

XQuery, 2nd Edition

Priscilla Walmsley
XPath and XPointer

XPath and XPointer

John Simpson
XQuery Kick Start

XQuery Kick Start

James McGovern, Per Bothner, Kurt Cagle, James Linn, Vaidyanathan Nagarajan
Learning XSLT

Learning XSLT

Michael Fitzgerald

Publisher Resources

ISBN: 0596006349Supplemental ContentErrata