posts - 165, comments - 198, trackbacks - 0, articles - 1
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

xquery 学习 (简单demo)

Posted on 2008-05-29 14:49 G_G 阅读(1160) 评论(1)  编辑  收藏 所属分类: xml Related
xml 数据库使用,和XQuery使用.
环境:
    1.xml数据库使用(参考:eXistQuick Start
    2.xQuery XQuery 首页
   
1.测试开始:
    进入:eXist-> http://demo.exist-db.org/xmldb/db/ 
for $x in doc("/examples2.xml")/exist:result/country return if ($x/population_growth<-1) then <child>{data($x/name)}</child> else <adult>{data($x/name)}</adult>
parent collection: /db
<child > Bosnia and Herzegovina </ child >
<adult > Czech Republic </ adult >
<child > Estonia </ child >
<child > Faroe Islands </ child >
<adult > Hungary </ adult >
<adult > Ireland </ adult >
<child > Latvia </ child >
<adult > Lithuania </ adult >
<child > Romania </ child >
<adult > Russia </ adult >

使用数据:
    http://demo.exist-db.org/xmldb/db/examples2.xml


2:自定义方法:
    使用:http://demo.exist-db.org/sandbox/sandbox.xql
   
declare function local:minPrice(){
  
for $x in (1 to 5)
  
return <test>{$x}</test>
};

<minPrice>{local:minPrice()}</minPrice>
结果:
<
minPrice>
<test>1</test>
<test>2</test>
<test>3</test>
<test>4</test>
<test>5</test>
</minPrice>





评论

# re: xquery 学习 (简单demo)  回复  更多评论   

2009-09-17 09:31 by www.04js.cn
www.04js.cn

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


网站导航: