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

          xquery 學習 (簡單demo)

          Posted on 2008-05-29 14:49 G_G 閱讀(1188) 評論(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
          主站蜘蛛池模板: 德阳市| 康保县| 平南县| 高唐县| 忻州市| 衡阳县| 西乌| 英超| 沈阳市| 乌兰察布市| 花莲县| 南皮县| 伊通| 堆龙德庆县| 虎林市| 泗水县| 汝城县| 监利县| 连江县| 闽清县| 兴化市| 伊宁县| 湛江市| 沁源县| 陕西省| 东宁县| 鄯善县| 长寿区| 凤阳县| 琼海市| 兴和县| 沙洋县| 康乐县| 广宗县| 龙井市| 潜江市| 中方县| 六枝特区| 张掖市| 富宁县| 甘泉县|