XQuery Tutorial
What is XQuery?
XQuery is a language for finding and extracting elements and attributes from XML documents.
XQuery was designed to query XML data.
![]() |
|
XQuery Example
Select all books with a price higher than $30 from the book collection in "books.xml":
for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title
return $x/title
XQuery - Examples of Use
XQuery can be used to:
- Extract information to use in a Web Service
- Generate summary reports
- Transform XML data to XHTML
- Search Web documents for relevant information
XQuery and XPath
XQuery 1.0 and XPath 2.0 share the same data model and support the same functions and operators. If you have already studied XPath you will have no problems with understanding XQuery.
XQuery is a W3C Recommendation
XQuery is compatible with several W3C standards, such as XML, Namespaces, XSLT, XPath, and XML Schema.
XQuery 1.0 became a W3C Recommendation in 2007.
