gembin

OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

HBase, Hadoop, ZooKeeper, Cassandra

Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

About Me

 

XQuery 语法

What is XQuery?
什么是XQuery?

  • XQuery is the language for querying XML data
    XQuery是查询XML数据的语言
  • XQuery for XML is like SQL for databases
    XQuery与XML的关系类似于SQL与数据库的关系
  • XQuery is built on XPath expressions
    XQuery 是建立在XPath表达式基础上的
  • XQuery is defined by the W3C
    XQuery是由W3C 定义的
  • XQuery is supported by all the major database engines (IBM, Oracle, Microsoft, etc.)
    所有重要的数据库引擎(如:IBM、Oracle、Microsoft,等等)都支持XQuery
  • XQuery will become a W3C standard - and developers can be sure that the code will work among different products
    XQuery将会成为W3C的标准 —— 开发者都确信代码可以在不同的产品之间运行

XQuery is About Querying XML
XQuery 是用于查询XML的

XQuery is a language for finding and extracting elements and attributes from XML documents.
XQuery是用于从XML文档中查找和提取元素和属性的语言。

Here is an example of a question that XQuery could solve:
下面是一个关于XQuery所能解决的问题的案例:

"Select all CD records with a price less than $10 from the CD collection stored in the XML document called cd_catalog.xml".
从存储在名为 “cd_catalog.xml” 的XML文档内的CD集中选择所有价格低于10美元的CD唱片。


XQuery and XPath
XQuery 和 XPath

XQuery 1.0 and XPath 2.0 share the same data model and support the same functions and operators. If you have already studied XPath you will have no problems with understanding XQuery.
XQuery 1.0 和 XPath 2.0 具有相同的数据模型并支持相同的函数和操作符。如果你已经掌握了XPath的相关知识,那么,理解XQuery就不成问题了。

You can read more about XPath in our XPath Tutorial.
你可以 在我们的XPath 教程中学习更多关于XPath的知识。


XQuery - Examples of Use
XQuery —— 使用案例

XQuery can be used to:
XQuery 可用于下述操作:

  • Extract information to use in a Web Service
    获取在Web服务中使用的信息
  • Generate summary reports
    产生综合报告。
  • Transform XML data to XHTML
    把XML数据转换成XHTML形式
  • Search Web documents for relevant information
    在Web文档中搜索相关信息

XQuery is Not (Yet) a Web Standard
XQuery 并不是网络标准

XQuery is compatible with several W3C standards, such as XML, Namespaces, XSLT, XPath, and XML Schema.
XQuery和一些W3C的标准是相互吻合的,例如:XML、Namespaces [命名空间]、XSLT、XPath 和 XML Schema。

However, XQuery 1.0 is not yet a W3C Recommendation (XQuery is a Working Draft). Hopefully it will be a recommendation in the near future.
然而,XQuery 1.0 并不是W3C的推荐标准(XQuery 仅是一份工作草案)。相信在不久的将来,它会变成 W3C 推荐的标准吧。

Let's try to learn some basic XQuery syntax by looking at an example.
让我们通过下面这个案例来学习一些关于XQuery 的基本语法。


The XML Example Document
XML 案例文档

We will use the following XML document in the examples below.
我们将在下面的案例中使用“books.xml”文档:

"books.xml":
“books.xml”文件内容如下:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="COOKING">

<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>

</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>

<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>

<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>

<year>2003</year>
<price>49.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>

<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>

View the "books.xml" file in your browser.
在浏览器中浏览“books.xml”文件


How to Select Nodes From "books.xml"?
如何从"books.xml"文件中选择节点?

Functions
函数

XQuery uses functions to extract data from XML documents.
XQuery 使用函数从XML文档中获取数据。

The doc() function is used to open the "books.xml" file:
doc() 函数用于打开"books.xml"文件:

doc("books.xml")

Path Expressions
路径表达式

XQuery uses path expressions to navigate through elements in an XML document.
XQuery 通过路径表达式操作XML文档中的元素。

The following path expression is used to select all the title elements in the "books.xml" file:
下述路径表达式用于在"books.xml"文件中选择 title 元素:

doc("books.xml")/bookstore/book/title

(/bookstore selects the bookstore element, /book selects all the book elements under the bookstore element, and /title selects all the title elements under each book element)
(/bookstore 选择 bookstore元素;/book 选择 bookstore 元素下的所有 book 元素;/title 选择每个book 元素下的所有title元素。

The XQuery above will extract the following:
上述的XQuery会获取下述内容:

<title lang="en">Everyday Italian</title>
<title lang="en">Harry Potter</title>
<title lang="en">XQuery Kick Start</title>
<title lang="en">Learning XML</title>

Predicates
条件谓语项

XQuery uses predicates to limit the extracted data from XML documents.
XQuery 使用条件谓语项给从XML文件中摘取的数据附加一个条件。

The following predicate is used to select all the book elements under the bookstore element that have a price element with a value that is less than 30:
下面的条件谓语项是用来选择 bookstore 元素下 price 元素值小于30的所有 book 元素的表达式:

doc("books.xml")/bookstore/book[price<30]

The XQuery above will extract the following:
上述XQuery语句会获取下面的内容:

<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>

<year>2005</year>
<price>29.99</price>
</book>


The XML Example Document
XML 案例文档

We will use the "books.xml" document in the examples below (same XML file as in the previous chapter).
下述案例中,我们会用到 "books.xml" 文档(上一章使用的XML文件)。

View the "books.xml" file in your browser.
在你的浏览器中浏览“books.xml”


How to Select Nodes From "books.xml" With FLWOR
怎样使用FLWOR表达式从"books.xml"文件中选择节点

Look at the following path expression:
先看看下面的路径表达式:

doc("books.xml")/bookstore/book[price>30]/title

The expression above will select all the title elements under the book elements that are under the bookstore element that have a price element with a value that is higher than 30.
上述表达式将选择 bookstore 元素下的 book 元素下的所有price 元素值大于30的 title 元素。

The following FLWOR expression will select exactly the same as the path expression above:
下述FLWOR表达式和上述路径表达式选择的值相同:

for $x in doc("books.xml")/bookstore/book
where $x/price>30
return $x/title

The result will be:
结果如下:

<title lang="en">XQuery Kick Start</title>

<title lang="en">Learning XML</title>

With FLWOR you can sort the result:
你可以使用FLWOR对结果进行分类排序:

for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title
return $x/title

FLWOR is an acronym for "For, Let, Where, Order by, Return".
FLWOR是 "For、Let、Where、Order by、Return" 的首字母缩写。

The for clause selects all book elements under the bookstore element into a variable called $x.
For子句把 bookstore 元素中的所有 book 元素发送到名为 $x 的变量内。

The where clause selects only book elements with a price element with a value greater than 30.
Where 子句仅选择price元素值高于30的book元素。

The order by clause defines the sort-order. Will be sort by the title element.
order by 子句定义了“ 分类命令 ”。根据 title 元素进行分类。

The return clause specifies what should be returned. Here it returns the title elements.
Return 子句指定了返回的数据。这里返回的是 title 元素。

The result of the XQuery expression above will be:
上述 XQuery 表达式的结果如下:

<title lang="en">Learning XML</title>

<title lang="en">XQuery Kick Start</title>

The XML Example Document
XML 案例文档

We will use the "books.xml" document in the examples below (same XML file as in the previous chapters).
下述案例中,我们会用到 "books.xml" 文档(上一章使用的XML文件)。

View the "books.xml" file in your browser.
在你的浏览器中浏览“books.xml”


Present the Result In an HTML List
在HTML列表中显示结果

Look at the following XQuery FLWOR expression:
先看看下面的Query FLWOR表达式:

for $x in doc("books.xml")/bookstore/book/title
order by $x
return $x

The expression above will select all the title elements under the book elements that are under the bookstore element, and return the title elements in alphabetical order.
上述表达式会选择在 bookstore 元素下的 book 元素下所有 title 元素,并按字母顺序排列 title 元素后输出。

Now we want to list all the book-titles in our bookstore in an HTML list. We add <ul> and <li> tags to the FLWOR expression:
现在,我们希望在 HTML列表中列出 bookstore 的所有book-titles元素,因此,我们需要在 FLWOR 表达式中加入<ul>和<li>标签:

<ul>
{

for $x in doc("books.xml")/bookstore/book/title
order by $x
return <li>{$x}</li>

}
</ul>

The result of the above will be:
上述的结果显示如下:

<ul>
<li><title lang="en">Everyday Italian</title></li>
<li><title lang="en">Harry Potter</title></li>
<li><title lang="en">Learning XML</title></li>

<li><title lang="en">XQuery Kick Start</title></li>
</ul>

Now we want to eliminate the title element, and show only the data inside the title element:
现在,我们要除去 title 元素,只显示 title 元素里的数据:

<ul>
{
for $x in doc("books.xml")/bookstore/book/title
order by $x
return <li>{data($x)}</li>

}
</ul>

The result will be (an HTML list):
结果(一份HTML列表)显示如下:

<ul>
<li>Everyday Italian</li>
<li>Harry Potter</li>
<li>Learning XML</li>
<li>XQuery Kick Start</li>

</ul>

In XQuery, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes.
在XQuery中,有7中不同的节点:元素、属性、文本、命名空间、处理指令、注释、文档(根目录)节点。


XQuery 术语

Nodes
节点

In XQuery, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes. XML documents are treated as trees of nodes. The root of the tree is called the document node (or root node).
在XQuery里,有7中不同的节点:元素、属性、文本、命名空间、处理指令、注释、文档(根目录)节点,XML文档是节点树状结构。“树根”称作文档节点(或根节点)。

Look at the following XML document:
先看看下面这个XML文档:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>

<price>29.99</price>
</book>
</bookstore>

Example of nodes in the XML document above:
上述XML文档中的节点案例:

<bookstore>  (document node)
<author>J K. Rowling</author>  (element node)
lang="en"  (attribute node)

Atomic values
“原子值”属性值

Atomic values are nodes with no children or parent.
“原子值”属性值只没有子节点和父节点。

Example of atomic values:
“原子值”属性值案例:

J K. Rowling
"en"

Items

Items are atomic values or nodes.
“项”是指原子值或节点。


Relationship of Nodes
节点间关系

Parent
父类

Each element and attribute has one parent.
每个元素和属性都包含一个“父类”。

In the following example; the book element is the parent of the title, author, year, and price:
在下述案例中:book元素是title、author、year 和 price 元素的父类元素:

<book>
<title>Harry Potter</title>

<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>

Children
子类元素

Element nodes may have zero, one or more children.
元素节点可以包含任意个数的子类元素。

In the following example; the title, author, year, and price elements are all children of the book element:
在下述案例中,title、author、year 和 price元素都是book元素的子元素:

<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>

<price>29.99</price>
</book>

Siblings
同类元素

Nodes that have the same parent.
拥有相同的父类元素的节点称为同类元素。

In the following example; the title, author, year, and price elements are all siblings:
在下述案例中,title、author、year 和 price 元素都是“同类元素”:

<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>

<year>2005</year>
<price>29.99</price>
</book>

Ancestors
祖类元素

A node's parent, parent's parent, etc.
一个节点的父类元素,父类元素的父类元素,以此类推,称为该节点的祖类元素。

In the following example; the ancestors of the title element are the book element and the bookstore element:
在下述案例中,title元素的 “祖类元素” 是 book 元素和 bookstore 元素。

<bookstore>
<book>

<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>

</book>
</bookstore>

Descendants
孙类元素

A node's children, children's children, etc.
一个节点的子类元素,子类元素的子类元素,以此类推,称为孙类元素。

In the following example; descendants of the bookstore element are the book, title, author, year, and price elements:
在下述案例中,bookstore 元素的孙类元素是book、title、author、year 和 price 元素:

<bookstore> <book>
<title>Harry Potter</title>
<author>J K. Rowling</author>

<year>2005</year>
<price>29.99</price>
</book> </bookstore>



XQuery is case-sensitive and XQuery elements, attributes, and variables must be valid XML names.
Xquery 区分字母大小写,它的元素、属性、变量必须是有效的XML名称。


XQuery Basic Syntax Rules
XQuery 的基本语法规则

Some basic syntax rules:
一些基本语法规则:

  • XQuery is case-sensitive
    XQuery 区分字母大小写
  • XQuery elements, attributes, and variables must be valid XML names
    它的元素、属性、变量必须是有效的XML名称
  • An XQuery string value can be in single or double quotes
    一个 XQuery 字符串值可以写在单引号里或双引号里
  • An XQuery variable is defined with a $ followed by a name, e.g. $bookstore
    一个 XQuery 变量定义是在“$”的符号后面跟上名称等,例如:$bookstore
  • XQuery comments are delimited by (: and :), e.g. (: XQuery Comment :)
    XQuery 注释使用 “(: ”和“ :)” 进行分界,例如 (: XQuery Comment :)

XQuery Conditional Expressions
XQuery 的条件表达式

"If-Then-Else" expressions are allowed in XQuery.
XQuery 允许使用 "If-Then-Else" 条件表达式。

Look at the following example:
先看看下面的案例:

for $x in doc("books.xml")/bookstore/book
return if ($x/@category="CHILDREN")
then <child>{data($x/title)}</child>
else <adult>{data($x/title)}</adult>

Notes on the "if-then-else" syntax: parentheses around the if expression are required. else is required, but it can be just else ().
使用“if-then-else"条件语句时应注意的语法点:if 表达式允许出现圆括号;另外,如果使用了“if”,就必须使用“else”,也可以是else()。

The result of the example above will be:
上述案例输出的结果如下:

<adult>Everyday Italian</adult>
<child>Harry Potter</child>
<adult>Learning XML</adult>
<adult>XQuery Kick Start</adult>

 


XQuery Comparisons
XQuery 比较

In XQuery there are two ways of comparing values.
XQuery 有两种比较值的方法。

1. General comparisons: =, !=, <, <=, >, >=
常规比较符号:= 、 != 、 < 、 <= 、 > 、 >=

2. Value comparisons: eq, ne, lt, le, gt, ge
值的比较:eq 、 ne 、 lt 、 le 、 gt 、 ge

The difference between the two comparison methods are shown below.
下面列举了两种比较方法的不同之处。

Look at the following XQuery expressions:
先看看下面的XQuery表达式:

$bookstore//book/@q > 10
The expression above returns true if any q attributes
have values greater than 10.
如果所有上述q的属性值大于10,那么,表达式将返回“true”(真)
$bookstore//book/@q gt 10
The expression above returns true if there is only one
q attribute returned by the expression, and its value
is greater than 10. If more than one q is returned,
an error occurs.
如果表达式返回的q属性中,只有一个q值大于10,那么,上述表达式才返回“true”(真);否则

The XML Example Document
XML 案例文档

We will use the "books.xml" document in the examples below (same XML file as in the previous chapters).
下述案例中,我们会用到 "books.xml" 文档(上一章使用的XML文件)。

View the "books.xml" file in your browser.
在你的浏览器中浏览“books.xml”


Adding Elements and Attributes to the Result
向结果中添加元素和属性

As we have seen in a previous chapter, we may include elements and attributes from the input document ("books.xml) in the result:
就像在前几章中所看到的,我们可以把来自输入文档("books.xml)的元素和属性添加到结果中:

for $x in doc("books.xml")/bookstore/book/title
order by $x
return $x

The XQuery expression above will include both the title element and the lang attribute in the result, like this:
上述 XQuery 表达式会将 title 元素和 lang 属性添加到结果中,如下所示:

<title lang="en">Everyday Italian</title>

<title lang="en">Harry Potter</title>
<title lang="en">Learning XML</title>
<title lang="en">XQuery Kick Start</title>

The XQuery expression above returns the title elements the exact same way as they are described in the input document.
上述 XQuery 表达式获取了 title 元素,它们和原来在输入文档中被描述的一样。

We now want to add our own elements and attributes to the result!
现在,我们希望把我们自己的元素和属性添加到结果中。

Add HTML Elements and Text
添加 HTML 元素和文本

Now, we want to add some HTML elements to the result. We will put the result in an HTML list - together with some text:
现在,我们希望将一些HTML元素添加到结果中。我们将把结果连同一些文本内容放在一个HTML列表中:

<html>
<body>
<h1>Bookstore</h1>
<ul>
{
for $x in doc("books.xml")/bookstore/book
order by $x/title
return <li>{data($x/title)}. Category: {data($x/@category)}</li>

}
</ul>
</body>
</html>

The XQuery expression above will generate the following result:
上述XQuery表达式将会输出下面的结果:

<html>
<body>
<h1>Bookstore</h1>
<ul>
<li>Everyday Italian. Category: COOKING</li>

<li>Harry Potter. Category: CHILDREN</li>
<li>Learning XML. Category: WEB</li>
<li>XQuery Kick Start. Category: WEB</li>
</ul>
</body>
</html>

Add Attributes to HTML Elements
向HTML元素中添加属性

Next, we want to use the category attribute as a class attribute in the HTML list:
接下来,我们希望把 category 属性作为 HTML 列表的一个类属性:

<html>

<body>
<h1>Bookstore</h1>
<ul>
{
for $x in doc("books.xml")/bookstore/book
order by $x/title
return <li class="{data($x/@category)}">{data($x/title)}</li>
}

</ul>
</body>
</html>

The XQuery expression above will generate the following result:
上述XQuery表达式将会输出下面的结果:

<html>
<body> <h1>Bookstore</h1> <ul>
<li class="COOKING">Everyday Italian</li>

<li class="CHILDREN">Harry Potter</li>
<li class="WEB">Learning XML</li>
<li class="WEB">XQuery Kick Start</li>
</ul> </body>
</html>

Selecting and Filtering Elements
选择和过滤元素

As we have seen in the previous chapters, we are selecting and filtering elements with either a Path expression or with a FLWOR expression.
如同在前几章里所看到的那样,我们使用路径表达式或FLWOR表达式来选择和过滤元素。

Look at the following FLWOR expression:
先看看下面的FLWOR表达式:

for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title
return $x/title
  • for - (optional) binds a variable to each item returned by the in expression
    for -(可选的)给从 “in 表达式” 内返回每一个项绑定一个变量
  • let - (optional)
    let -(可选的)
  • where - (optional) specifies a criteria
    where -(可选的)指定了一个标准
  • order by - (optional) specifies the sort-order of the result
    order by - (可选的)指定了结果的排列次序
  • return - specifies what to return in the result
    return - 指定了在结果中返回的内容

The for Clause
For 子句

The for clause binds a variable to each item returned by the in expression. The for clause results in iteration. There can be multiple for clauses in the same FLWOR expression.
给从 “in 表达式” 中返回每一个项绑定一个变量。For子句会导致重复。在相同的FLWOR表达式中,可以包含多个for子句。

To loop a specific number of times in a for clause, you may use the to keyword:
在for子句中对一个指定的数字进行多次循环,你可以使用关键词 “ to ”:

for $x in (1 to 5)
return <test>{$x}</test>

Result:
结果:

<test>1</test>
<test>2</test>
<test>3</test>
<test>4</test>

<test>5</test>

The at keyword can be used to count the iteration:
关键字 “at” 可用于计算重复次数:

for $x at $i in doc("books.xml")/bookstore/book/title
return <book>{$i}. {data($x)}</book>

Result:
结果如下:

<book>1. Everyday Italian</book>
<book>2. Harry Potter</book>
<book>3. XQuery Kick Start</book>

<book>4. Learning XML</book>

It is also allowed with more than one in expression in the for clause. Use comma to separate each in expression:
在for子句中,允许出现一项或多项 “in 表达式”;使用逗号将表达式中的每项分开:

XQuery 1.0, XPath 2.0, and XSLT 2.0 share the same functions library.
XQuery 1.0、XPath 2.0 和 XSLT 2.0 包含相同的函数库。


XQuery Functions
XQuery 函数

XQuery includes over 100 built-in functions. There are functions for string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values, and more. You can also define your own functions in XQuery.
XQuery 包括超过100个内置函数,具体如下:字符串值、数值、日期时间值、节点以及QName操作、排序操作、逻辑值等函数。你也可以在XQuery内定义自己的函数。

XQuery Built-in Functions
XQuery 内置函数

The URI of the XQuery function namespace is:
http://www.w3.org/2005/02/xpath-functions

XQuery函数名称空间(namespaces)的URI是:
http://www.w3.org/2005/02/xpath-functions

The default prefix for the function namespace is fn:.
默认的函数命名空间前缀是fn:.

Tip: Functions are often called with the fn: prefix, such as fn:string(). However, since fn: is the default prefix of the namespace, the function names do not need to be prefixed when called.
提示:函数常常以“fn:”为前缀名调用,例如fn:string();然而,因为fn:是命名空间的默认前缀,所以这个函数的名称并不需要通过前缀名来调用。

The reference of all the built-in XQuery 1.0 functions is located in our XPath tutorial.
XQuery 1.0内置函数参考


Examples of Function Calls
函数调用实例

A call to a function can appear where an expression may appear. Look at the examples below:
函数调用可以出现在一个表达式中所有可能出现的地方,看下面的案例:

Example 1: In an element
例1:在一个元素中:

<name>{uppercase($booktitle)}</name>

Example 2: In the predicate of a path expression
例2:在路径表达的条件谓语项中:

doc("books.xml")/bookstore/book[substring(title,1,5)='Harry']

Example 3: In a let clause
例3:在let子句中:

let $name := (substring($booktitle,1,4))

 


XQuery User-Defined Functions
XQuery 用户自定义函数

If you cannot find the XQuery function you need, you can write your own.
如果你找不到需要使用的XQuery函数,你可以自己书写。

User-defined functions can be defined in the query or in a separate library.
用户自定义函数可以在查询语句或独立库中进行定义。

Syntax
语法

declare function prefix:function_name($parameter AS datatype)
AS returnDatatype
{
(: ...function code here... :)
};

Notes on user-defined functions:
用户自定义函数需要注意以下几点:

  • Use the declare function keyword
    使用 “declare function(函数声明)” 关键词
  • The name of the function must be prefixed
    函数名称要必须包含前缀
  • The data type of the parameters are mostly the same as the data types defined in XML Schema
    参数的数据类型要和在XML Schema中定义的数据类型基本一致
  • The body of the function must be surrounded by curly braces
    函数的主体部分必须在圆括号内书写

Example of a User-defined Function Declared in the Query
在查询语句里声明的用户自定义函数案例

declare function local:minPrice(
$price as xs:decimal?,
$discount as xs:decimal?)
AS xs:decimal?
{
let $disc := ($price * $discount) div 100
return ($price - $disc)
}; (: Below is an example of how to call the function above :) <minPrice>{local:minPrice($book/price, $book/discount)}</minPrice>

XQuery Summary
XQuery 概要

This tutorial has taught you how to query XML data.
这篇教程将教你如何查询XML数据。

You have learned that XQuery was designed to query anything that can appear as XML, including databases.
你应该已经了解:XQuery是用于查询包括数据库在内的以XML形式出现的任何内容。

You have also learned how to query the XML data with FLWOR expressions, and how to construct XHTML output from the collected data.
你应该已经了解怎样使用FLWOR表达式查询XML数据,以及怎样从已选数据里构建XHTML结果。

For more information on XQuery, please look at our XQuery Reference.
在我们的XQuery 参考上有关于XQuery的更多内容。


Now You Know XQuery, What's Next?
学会了XQuery,接下来该学些什么呢?

The next step is to learn about XLink and XPointer.
下一步是学习与 XLink 和 XPointer 相关的内容。

XLink and XPointer

Linking in XML is divided into two parts: XLink and XPointer.
XML中的链接分为两个部分:XLink 和XPointer。

XLink and XPointer define a standard way of creating hyperlinks in XML documents.
XLink 和 XPointer 定义了在XML文档里创建超链接的标准。

If you want to learn more about XLink and XPointer, please visit our XLink and XPointer tutorial.
在我们的XLink / XPointer教程中,你可以学习与 XLink 和 XPointer 相关的更多内容。



XQuery 1.0 and XPath 2.0 share the same data model and support the same functions and operators.
XQuery 1.0 和 XPath 2.0拥有同样的数据模式并支持相同的函数和操作。


XQuery Functions
XQuery函数

XQuery is built on XPath expressions. XQuery 1.0 and XPath 2.0 share the same data model and support the same functions and operators.
XQuery 是建立在 XPath 表达式的基础上的。XQuery 1.0 和 XPath 2.0 包含相同的数据模型并支持相同的函数和操作符。

XPath Operators
XPath 操作符

XPath Functions
XPath 函数

XQuery Data Types
XQuery 数据类型

XQuery shares the same data types as XML Schema 1.0 (XSD).
XQuery 和 XML Schema 1.0 (XSD) 包含了相同的数据类型。

XSD String
XSD 字符串

XSD Date
XSD 日期

XSD Numeric
XSD 数字

XSD Misc
XSD 混合数据类型


posted on 2007-12-13 14:26 gembin 阅读(1853) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿(6)

随笔分类(440)

随笔档案(378)

文章档案(6)

新闻档案(1)

相册

收藏夹(9)

Adobe

Android

AS3

Blog-Links

Build

Design Pattern

Eclipse

Favorite Links

Flickr

Game Dev

HBase

Identity Management

IT resources

JEE

Language

OpenID

OSGi

SOA

Version Control

最新随笔

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜

free counters