XQuery Tutorial

What is XQuery?

Designed to query the XML data, XQuery is to XML what SQL is to databases. It is built on XPath expressions and is supported by all major databases. It is a W3C Recommendation too.

Example:

for $x in doc("books.xml")/bookstore/book
where $x/price>100
order by $x/title
return $x/title

XQuery is About Querying XML:

To find and extract the elements and attributes from XML documents, the XQuery language is used.

XQuery and XPath:

Being sharing the same data model XQuery 1.0 and XPath 2.0 also supports the same functions and operators.

XQuery Uses:

  • XQuery can be used to extract information to use in a Web Service.
  • XQuery can be used to generate summary reports.
  • XQuery can be used to transform XML data to XHTML
  • XQuery can be used to search Web documents for relevant information.

XQuery is a W3C Recommendation:

Being compatible with several W3C standards, such as XML, Namespaces, XSLT, XPath, and XML Schema, XQuery 1.0 became a W3C Recommendation in 2007.

XQuery Tutorial List