posts - 165, comments - 198, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          xquery 學習 (簡單demo)

          Posted on 2008-05-29 14:49 G_G 閱讀(1193) 評論(1)  編輯  收藏 所屬分類: xml Related
          xml 數據庫使用,和XQuery使用.
          環(huán)境:
          ??? 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
          主站蜘蛛池模板: 景洪市| 开原市| 上杭县| 襄樊市| 东阳市| 孝义市| 江达县| 习水县| 棋牌| 上高县| 北海市| 永嘉县| 收藏| 聊城市| 葵青区| 西乌| 刚察县| 无极县| 临湘市| 富源县| 扶风县| 湾仔区| 华坪县| 星子县| 临汾市| 沿河| 濮阳市| 凤凰县| 霞浦县| 临西县| 诏安县| 时尚| 泌阳县| 临沧市| 嫩江县| 横峰县| 修文县| 松原市| 北宁市| 古蔺县| 东乡族自治县|