XML and XQuery

What is XQuery?

XQuery For XML, it is like SQL for databases.

XQuery Aims to query XML data.

XQuery Example

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

What is XQuery?

XQuery
  • XQuery is for querying XML dataLanguage
  • XQuery for XML is like SQL for databases
  • XQuery is built on top of XPath expressions
  • All major databases support XQuery
  • XQuery is a W3C Recommendation Standard.

XQuery is about querying XML

XQuery is a language used to find and extract elements and attributes from XML documents.

The following example illustrates a problem that XQuery can solve:

“Select all CD records with prices below $10 from the CD collection stored in cd_catalog.xml”

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 learned XPath, then understanding XQuery will be no problem.

XQuery - Application scenarios examples

XQuery can be used for:

  • Extract information used in web services
  • Generate a summary report
  • Convert XML data to XHTML
  • Search for relevant information in network documents

XQuery is a W3C Recommendation Standard.

XQuery is compatible with multiple W3C standards such as XML, Namespaces, XSLT, XPath, and XML Schema.

XQuery 1.0 became a W3C Recommendation Standard in 2007.

XQuery Tutorial

You will learn about XQuery For More Knowledge.