以文本方式查看主题

-  W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWL  (http://bbs.xml.org.cn/index.asp)
--  『 XQuery/XLink/XPointer/ 』  (http://bbs.xml.org.cn/list.asp?boardid=14)
----  XML xpath  starts-with 模糊查询不能正确返回[原创]  (http://bbs.xml.org.cn/dispbbs.asp?boardid=14&rootid=&id=89121)


--  作者:solonet
--  发布时间:1/13/2011 5:17:00 PM

--  XML xpath  starts-with 模糊查询不能正确返回[原创]

目标:  
   想要查出所有'/ITEMS'下面节点中 'TMaterial/FQTY/DATA/@FLAG'的值包含'P#@S01#@U01#@QD#@'的所有节点,查询路径如下
NodePath := '/ITEMS[starts-with(TMaterial/FQTY/DATA/@FLAG,''P#@S01#@U01#@QD#@'')]'
NodeList_RCJ := myXmlDoc.selectNodeS(NodePath);
Element_RCJ := NodeList_RCJ.item[0];
按照这个去查询,结果是把'TMaterial/FQTY/DATA/@FLAG'的值包含'P#@S02#@U01#@QD#@'的结果也返回了(如下第二条TMaterial )
<ITEMS>
 <TMaterial ZHPRICE="30" MSPEC="" PRICE="30" HASCONTENT="F" HS="1" MATESRC="1" RCJTYPE="R" MATETYPE="40" PRICESRC="3" INFORPRICEFILENAME="" INFOMATERIALID="" MATEPRV="B" XIANJIABI="0" MEMO="" MAINMATE="F" TENDERPRICE="0" TENDERQTY="0" TRADEMARK="" FACTORY="" ZGJ="F" EXPANDED="F" CODE="4000000012" NAME="综合人工" TOTAL="0" UNIT="工日" LAYER="2" CALCULATED="T" SELECTED="F">
  <ITEMS/>
  <FQTY>
   <DATA FLAG="P#@S01#@U01#@QD#@L01#@010101001001#@" VALUE="2.313" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S01#@U01#@QD#@L01#@010101003001#@" VALUE="2.708" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S01#@U01#@QD#@L01#@010101003002#@" VALUE="2.708" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S01#@U01#@QD#@L01#@010101003005#@" VALUE="2.708" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S01#@U01#@CS#@L01#@0001#@" VALUE="0.2056" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S01#@U01#@CS#@L01#@0002#@" VALUE="2.835" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S02#@U01#@QD#@L01#@030101001#@" VALUE="420" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S02#@U01#@QD#@L01#@030101002#@" VALUE="1560" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S02#@U01#@QD#@0308#@030101003#@" VALUE="0" SIGN="DEF" REFCOUNT="1"/>
   <DATA FLAG="P#@S02#@U01#@QD#@0308#@030101004#@" VALUE="0" SIGN="DEF" REFCOUNT="1"/>
  </FQTY>
 </TMaterial>

 <TMaterial ZHPRICE="794.48" MSPEC="200t.m" PRICE="794.48" HASCONTENT="F" HS="1" MATESRC="1" RCJTYPE="J" MATETYPE="410306" PRICESRC="3" INFORPRICEFILENAME="" INFOMATERIALID="" MATEPRV="B" XIANJIABI="25" MEMO="" MAINMATE="F" TENDERPRICE="0" TENDERQTY="0" TRADEMARK="" FACTORY="" ZGJ="F" EXPANDED="F" CODE="4103060020" NAME="自升式塔式起重机" TOTAL="0" UNIT="台班" LAYER="2" CALCULATED="F" SELECTED="F">
  <ITEMS/>
  <FQTY>
   <DATA FLAG="P#@S02#@U01#@QD#@L01#@030101002#@" VALUE="2" SIGN="DEF" REFCOUNT="1"/>
  </FQTY>
 </TMaterial>

 <TMaterial ZHPRICE="13.06" MSPEC="φ90×6000" PRICE="13.06" HASCONTENT="F" HS="1" MATESRC="1" RCJTYPE="C" MATETYPE="020908" PRICESRC="3" INFORPRICEFILENAME="" INFOMATERIALID="" MATEPRV="B" XIANJIABI="15" MEMO="" MAINMATE="F" TENDERPRICE="0" TENDERQTY="0" TRADEMARK="" FACTORY="" ZGJ="F" EXPANDED="F" CODE="0209080002" NAME="竹脚手杆" TOTAL="0" UNIT="根" LAYER="2" CALCULATED="F" SELECTED="F">
  <ITEMS/>
  <FQTY>
   <DATA FLAG="P#@S01#@U01#@QD#@L01#@010101001001#@" VALUE="1.2" SIGN="DEF" REFCOUNT="1"/>
  </FQTY>
 </TMaterial>
</ITEMS>

请高手指教!不胜感激!!!


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.006ms