xml 數據庫使用,和XQuery使用.
環境:
??? 1.xml數據庫使用
(參考:eXistQuick Start)
??? 2.xQuery XQuery 首頁
???
1.測試開始:
??? 進入:eXist-> http://demo.exist-db.org/xmldb/db/?
使用數據:
??? http://demo.exist-db.org/xmldb/db/examples2.xml
2:自定義方法:
??? 使用:http://demo.exist-db.org/sandbox/sandbox.xql
???
環境:
??? 1.xml數據庫使用

??? 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 | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
使用數據:
??? 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>
??for?$x?in?(1?to?5)
??return?<test>{$x}</test>
};
<minPrice>{local:minPrice()}</minPrice>
結果:
<minPrice>
<minPrice>
<test>1</test>
<test>2</test>
<test>3</test>
<test>4</test>
<test>5</test>
</minPrice>