What is XQuery?

XQuery, while still in final draft stage, is the much awaited query language for XML. XQuery provides XML with somewhat equivalent functionality of what SQL provides to relational databases. It offers a convenient, efficient, and straightforward method to extract information from one or multiple xml documents. This information may be filtered using arbitrary criteria and represented in any format chosen by the user.

XQuery is a declarative language. It considers the versatility of XML and is therefore flexible enough to be used for either document or data oriented XML. It is a strongly typed language that supports namespaces and XML Schema datatypes. XQuery offers two different syntaxes, one that is in XML format, and one that is easily read and written by people.

Learning XQuery

XQuery has been in draft stage for many years and a good number of websites and articles have not been updated as XQuery continued evolving. As you research XQuery information online, you will have to assess the timeliness and accuracy of the information. The most accurate source of information is always the W3C documentation, but lengthy technical documents are not for everyone, and a tutorial is probably the best place for most people to start.

This site will soon contain an updated XQuery tutorial. In the meantime, you may want to take a look at the ones listed below. Be aware that XQuery relies heavily on XPath (XQuery is actually a superset of XPath), so understanding at least the basics of XPath is essential to achieving anything useful with XQuery. Most tutorials I've seen assume the reader has little or no XPath experience.

Sample XQueries

Querying the academy awards