XQuery与XQJ的介绍与使用

1.XQuery

XQuery

XQuery is to XML what SQL is to database tables.

XQuery was designed to query XML data.

XQuery对于XML,就像SQL对于数据库表。

XQuery被设计用来查询XML数据。

W3C规范:http://www.w3schools.com/xquery/

http://www.w3schools.com/xquery/xquery_reference.asp

XQuery对XML的处理很直观,很强大,基于XPath表达式,被各种数据库支持。

而且XQuery与XPath关系紧密(相同的数据模型、相同的函数和操作)。

XQuery的历史与入门:http://www.ibm.com/developerworks/cn/xml/x-xquery.html

XQuery使用:http://www.xquery.com/tutorials/xquery_tutorial/

XQuery函数:http://www.xquery.com/tutorials/xquery-functions/

比较好的Xquery工具有XMLSpy。

XQuery示例:

  • Extract information to use in a Web Service
  • Generate summary reports
  • Transform XML data to XHTML
  • Search Web documents for relevant information

支持的操作“:

Operator Description Example Return value
| Computes two node-sets //book | //cd Returns a node-set with all book and cd elements
+ Addition 6 + 4 10
- Subtraction 6 - 4 2
* Multiplication

6 * 4

24
div Division 8 div 4 2
= Equal price=9.80 true if price is 9.80
false if price is 9.90
!= Not equal price!=9.80 true if price is 9.90
false if price is 9.80
< Less than price<9.80 true if price is 9.00
false if price is 9.80
<= Less than or equal to price<=9.80 true if price is 9.00
false if price is 9.90
> Greater than price>9.80 true if price is 9.90
false if price is 9.80
>= Greater than or equal to price>=9.80 true if price is 9.90
false if price is 9.70
or or price=9.80 or price=9.70 true if price is 9.80
false if price is 9.50
and and price>9.00 and price<9.90 true if price is 9.80
false if price is 8.50
mod Modulus (division remainder) 5 mod 2 1
支持的函数:

支持的数据类型(源于XSD 1.0):

XSD String

XSD Date

XSD Numeric

XSD Misc

Misc包括:boolean, base64Binary, hexBinary, float, double, anyURI, QName, and NOTATION.

2.XQJ

XQJ(XQuery for Java API) 是在 Sun 的支持下作为 Java Community Process, JSR 225的一部分开发的。

直接使用XQuery操作xml,data direct xquery: http://www.stylusstudio.com/xquery/


XQJ入门:http://www.xquery.com/tutorials/xqj_tutorial/

java里使用XQuery:http://www.xquery.com/tutorials/xquery-java/

XQEngine:作者自己基于 Java 的开放源码查询引擎。现在有点落后了,因为至少目前作者放弃了跟踪规范的修改。

xmlbeans对xquery的支持:http://xmlbeans.apache.org/docs/2.0.0/guide/conSelectingXMLwithXQueryPathXPath.html

        selectPath for XPath and execQuery for XQuery.       

saxon对xquery的至支持:http://saxon.sourceforge.net/   

	queryExpression.run(dynamicQueryContext, result, props); //http://www.ibm.com/developerworks/cn/xml/x-xquerymashup/

其他:

c++的xquery支持 xqilla:http://xerces.apache.org/xerces-c/applications.html


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kimmking

赠人玫瑰手有余香

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值