Browse DevX
Sign up for e-mail newsletters from DevX


Introduction to XQuery (Part 1 of 4)

XML blurs the distinctions between databases, documents, and messages, but it needs a powerful and elegant query language to reach its full potential. XPath does not go far enough. XQuery intends to be that language.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

ver the past few years, XML has rapidly gained popularity as a formatting language for information, finding constituencies in both the document-centric and data-centric worlds. The explosive growth of XML-based standards bears testimony to XML's interest to many different technical communities. Applications now use XML for both transient messages, such as SOAP or XML-RPC messages, and as persistent storage, such as in XML databases or content management systems. An XML-based Web, as opposed to an HTML-based Web, no longer sounds like fantasy. As the volume of information stored in XML grows, it becomes correspondingly more important to be able to access information in XML documents efficiently and effectively. To do that, you need an expressive query language so you can specify precisely what information you want to retrieve or update in an XML data source. XQuery intends to be that language.

An XML-based Web, as opposed to an HTML-based Web, no longer sounds like fantasy.
This, the first of a four part series introduces you to the XQuery query language. It explains basic XQuery concepts such as the different types of query expressions, the language elements, such as user-defined functions, and illustrates them with example queries. The Example Scenario
In this article series, you'll explore important XQuery concepts through series of examples based on a single scenario that will be familiar to most developers. You'll work with an order-processing application that uses three types of documents: purchase orders po.xml, a customer list customers.xml and an items list items.xml. You can download the sample documents and all the queries from the References column on every page. For readers who are familiar with relational databases, the document po.xml is analogous to a purchase orders table (each record in the table represents a purchase order, just as each <po> element in the document represents a purchase order), the document customers.xml is analogous to a customers table and the document items.xml is equivalent to the inventory/catalog table. These analogies can also help you compare the capabilities of XQuery with those of SQL

XQuery Overview
XQuery is a query language that lets you retrieve data items from XML-formatted documents. The language is not "complete"— it's still a work in progress under the auspices of the W3C's XML Query working group. Nonetheless, implementations of XQuery are already making their way to the market.. The XML Query working group published its latest public XQuery specification working draft on December 20, 2001, and this series is based on that version of the specification.

Thanks for your registration, follow us on our social networks to keep up-to-date