Chapter 2. XQuery Foundations

This chapter provides a brief overview of the foundations of XQuery: its design, its place among XML-related standards, and its processing model. It also discusses the underlying data model behind XQuery and the use of types and namespaces in queries.

The Design and History of the XQuery Language

The XML Query Working Group of the World Wide Web Consortium (W3C) began work on XQuery in 1999. It used as a starting point an XML query language called Quilt, which was itself influenced by two earlier XML query languages: XQL and XML-QL.

The working group set out to design a language that would:

  • Be useful for both highly structured and semi-structured documents

  • Be protocol-independent, allowing a query to be evaluated on any system with predictable results

  • Be a declarative language rather than a procedural one

  • Be strongly typed, allowing queries to be “compiled” to identify possible errors and to optimize evaluation of the query

  • Allow querying across collections of documents

  • Use and share as much as possible with appropriate W3C recommendations, such as XML, Namespaces in XML, XML Schema, and XPath

The XQuery recommendation and related supporting standards include over 15 separate documents and over 1,000 printed pages. These documents are listed (with links) at the public XQuery website at http://www.w3.org/XML/Query. The various recommendation documents are generally designed to be used by implementers of XQuery software, and they vary in readability and accessibility. ...

Get XQuery, 2nd Edition 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.