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

          xquery 學習 (簡單demo)

          Posted on 2008-05-29 14:49 G_G 閱讀(1184) 評論(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
          主站蜘蛛池模板: 贡觉县| 封开县| 仙游县| 阳信县| 平度市| 左权县| 平塘县| 云林县| 延吉市| 博罗县| 荆州市| 抚顺县| 神池县| 年辖:市辖区| 南平市| 和平区| 安岳县| 延庆县| 佛冈县| 桦川县| 勐海县| 华安县| 平罗县| 江源县| 桃源县| 武清区| 滕州市| 郓城县| 衡南县| 阿克苏市| 亳州市| 祁门县| 遂宁市| 昌宁县| 礼泉县| 若尔盖县| 赤水市| 永仁县| 连平县| 云梦县| 磐安县|