Tải bản đầy đủ (.pdf) (2 trang)

Tài liệu What Is XQueryX? pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (61.15 KB, 2 trang )



Appendix B: What Is XQueryX?
One of the most recent developments in the work on XQuery is the efforts of
the World Wide Web Consortium (W3C) to specify the XQueryX language.
This language enables the full rendering of XQuery in Extensible Markup
Language (XML) for computer-readable use and ensures its compliance with
W3C requirements. XQueryX is not designed for direct human use.
XQueryX is in the very early stages of development. This topic is included to
alert you to this emerging technology and to show the rapid pace of innovation
with XML.

For more information about XQueryX, check the W3C site regularly to
monitor the evolution of this probable standard. See the W3C paper XML
Syntax for XQuery 1.0 (XQueryX) of June 7, 2001, at


XQueryX is needed to make the programmatic use of XQuery consistent with
other XML languages and techniques. XQuery in the form you have learned it
so far does not appear in true XML format. By using XQueryX, you can turn an
XQuery expression into an XML document. If you can represent an XQuery
expression in XML through XQueryX, then all other XML techniques for
navigation and modification are available to the XML programmer.
Introduction
Note
Why is XQueryX
needed?
2 Appendix B: What Is XQueryX?




Consider the following FLWR expression from books.xml:
FOR $b IN document("books.xml")//book
WHERE $b/publisher = "New Moon Books" and $b/year = "1991"
RETURN
$b/title

Converting this to XQueryX produces the following XML document:
<q:query xmlns:q="
<q:flwr>
<q:forAssignment variable="$b">
<q:step axis="SLASHSLASH">
<q:function name="document">
<q:constant
datatype="CHARSTRING">books.xml</q:constant>
</q:function>
<q:identifier>book</q:identifier>
</q:step>
</q:forAssignment>
<q:where>
<q:function name="AND">
<q:function name="EQUALS">
<q:step axis="CHILD">
<q:variable>$b</q:variable>
<q:identifier>publisher</q:identifier>
</q:step>
<q:constant datatype="CHARSTRING">New Moon
Books</q:constant>
</q:function>
<q:function name="EQUALS">
<q:step axis="CHILD">

<q:variable>$b</q:variable>
<q:identifier>year</q:identifier>
</q:step>
<q:constant datatype="CHARSTRING">1991</q:constant>
</q:function>
</q:function>
</q:where>
<q:step axis="CHILD">
<q:variable>$b</q:variable>
<q:identifier>title</q:identifier>
</q:step>
</q:flwr>
</q:query>

As you can see, XQueryX is not easy for humans to use, but it is extremely
efficient for XML processors. With the extension of XQuery into many areas of
Internet and Web activity, such computer-readable and programmer-readable
code is essential to the full realization of XQuery’s capabilities.

Example

×