XQuery, concluded - Looking Ahead
(Page 5 of 5 )
XQuery is used to query information contained in an XML document. The XQuery is processed by the XQuery processor. Some of these processors are freeware or open source and others are commercial software products.
An XQuery is typed into an editor and saved to a file that contains the .xq file extension. The XQuery file is then passed to the XQuery processor as a command line argument. The result of the XQuery is contained in the output.html file, which you can open in your browser.
An XQuery contains conditional expressions that define search criteria. A conditional expression can be either true or false. Portions of the XML document that meet the search criteria are copied to the output.html file.
XML Demystified
The for and let clauses are used to assign values to variables within the XQuery. The order by clause is used to sort the results in ascending or descending order. The where clause specifies a filter criteria using the conditional expression and the return clause identifies information that the XQuery processor returns to the output .html file.
In the next chapter you’ll learn about MSXML, which lets you combine the power of XML and programming languages such as JavaScript, Visual Basic, and C++ when using Microsoft’s XML Core Services.
Quiz
Saxon-B is the only software that can process an XQuery.
a. True
b. False
What kind of clause is used to specify the filter criteria?
a. SQL clause
b. Declarative clause
c. where clause
d. None of the above
$x is an
a. Element
b. Attribute
c. XQuery
d. Variable
Order by
a. Places all elements in the XML document in ascending order
b. Places all elements in the XML document in descending order
c. Places all return values in ascending order by default
d. Places all return values in descending order by default
The where clause
a. Locates the XML document
b. Locates the output file
c. Specifies the filter criteria
d. All of the above
All functions used by an XQuery are built-in functions.
a. True
b. False
The data() function returns the text value of a variable.
a. True
b. False
A constructor
a. Converts information contained in an XML document to another data type
b. Is the first instance of a function
c. Is the first instance of a variable
d. None of the above
The doc() function retrieves an XML document.
a. True
b. False
The round-half-to-even() function rounds half the value returned by a function.
a. True
b. False
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
|
This article is excerpted from chapter nine of the book XML DeMYSTiFieD, written by Jim Keogh and Ken Davidson (McGraw-Hill/Osborne, 2005; ISBN: 0072262109). Check it out today at your favorite bookstore. Buy this book now.
|
|