Large amounts of information are now being stored as XML or can be made available as XML from relational and other databases with XML functionality. As the volume of XML-based information increases, the need for a query language to efficiently query and make use of that XML data is obvious. At the time of writing, the W3C, the World Wide Web Consortium, is developing an XML query language called XQuery. This chapter introduces you to using XQuery and walks you through several working examples using XQuery's features.
XQuery is likely to become as important in the XML world as SQL has become in the relational database world. In the near future, any self-respecting developer who uses XML will be expected to have at least a basic understanding of XQuery and the skill to use it to carry out frequently used queries. Those who work routinely with large volumes of XML data will be expected to have significant expertise in using XQuery as they create programmatic solutions to XML data-handling business issues.
In this chapter you will learn the following:
Why XQuery was created to complement languages such as SQL and XSLT
How to get started with XQuery using the XQuery tools that are already available
How to query an XML document using XQuery and how to create new elements in the result using element constructors
About the XQuery data model and how to use the different types of expression in XQuery, including the important
for, let, where, order ...