Next page Previous page Start of chapter End of chapter

XQuery: moving the first steps

We will learn XQuery by example. We propose a set of queries to be interpreted on XMark generated documents.

The simplest xquery just loads an XML document: the doc() function loads the XML document given as argument, as in the following example:

doc("auction.xml")

The result of the query is the entire loaded document. As said above, XPath queries are valid xqueries. Typically, the document on which the XPath query should be evaluated is loaded and then the query is applied to this document. Here is an example:

doc("auction.xml")/site/people/person[not(watches/watch)]

The result is a sequence of person elements, sorted according to the document order, that corresponds to people that are not watching any open auction.

Next page Previous page Start of chapter End of chapter
Caffè XML - Massimo Franceschet