XQuery Introduction
The best way to explain XQuery is this: the relationship between XQuery and XML is the same as the relationship between SQL and database tables.
XQuery is designed to query XML data - not limited to XML files, but also any data that can be presented in XML form, including databases.
The basic knowledge you should have:
Before you continue learning, you need to have a basic understanding of the following:
- HTML / XHTML
- XML / XML namespaces
- XPath
If you wish to learn these topics first, please visit our Home to access these tutorials.
What is XQuery?
|
|
- XQuery is a language for querying XML data
- XQuery's role for XML is similar to SQL's role for databases
- XQuery is built on XPath expressions
- XQuery is supported by all major database engines (IBM, Oracle, Microsoft, etc.)
- XQuery is a W3C standard
XQuery relates to XML querying
XQuery is a language used to find and extract elements and attributes from XML documents.
Here is an example of XQuery solving a real problem:
"Select all CD records priced below 10 dollars from the CD collection stored in the XML document named 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, learning XQuery will be no problem.
You can read more about XML standards in ourXPath Tutorialto read more about XPath.
XQuery - Application examples
XQuery can be used to:
- Extract information for use in web services
- Generate summary reports
- Transform XML data into XHTML
- Search web documents to obtain relevant information
XQuery is a W3C Recommendation
XQuery is compatible with multiple W3C standards, such as XML, Namespaces, XSLT, XPath, and XML Schema.
XQuery 1.0 was established as a W3C Recommendation on January 23, 2007.
For more information about W3C's XQuery activities, please read ourW3C Tutorial".