IBM Version 5 Universal Remote User Manual


 
Chapter 2. Technologies in XML 41
and made obsolete by other documents at any time. Because it contains many
open issues it is considered to be fully stable.
The first draft introduced the XQuery language and provided examples, while the
second draft introduced function signatures and other expressions. The second
draft exemplified the semantics of element and attributes, and how the
underlaying data was operated upon.
The XML query language was specified to be one that made use of XML
structure, and have the ability to, conduct queries across all these kinds of data,
whether physically stored in XML or viewed as XML via middleware.
This section of the book does not go into the details of XQuery, but provides
examples to show the main flow of the language. This will provide an overview of
what XQuery is likely to provide. The examples and explanations that follow are
taken from the first draft.
The XQuery language consists of the forms below. Explanations of some are
given:
Path expressions
Element expressions
FLWR ( FOR, LET, WHERE, and RETURN clauses)
Expressions involving operators and functions
Conditional expressions
Quantified expressions
List constructors
Expressions that test and modify datatypes
Path expressions
A path expression is a series of steps, where one step of the path may serve as
an endpoint, or may have multiple values. Each step may serve as a starting
point of the next step, if they exist. Here are some queries expressed in the
English form, and then the XQuery form:
In the second chapter of the document named zoo.xml, find the figure(s) with
caption Tree Frogs.
document("zoo.xml")/chapter[2]//figure[caption = "Tree Frogs"]
In this example, the first step finds the document, the second locates Chapter 2,
and the last step filters all captions in that chapter for Tree Frogs.
Find all the figures in Chapters 2 to 5 of the document named "zoo.xml."
document("zoo.xml")/chapter[RANGE 2 TO 5]//figure