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 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 semistructured 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 1.0, Namespaces, XML Schema, and XPath

The XQuery recommendation includes 11 separate documents and over 1,000 printed pages. These documents are listed (with links) at the public XQuery web site 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 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.