首页 新闻 会员 周边

请问SelectSingleNode的参数怎么写?

0
悬赏园豆:20 [已解决问题] 解决于 2009-04-08 10:22

怎么根据多个属性查找节点

例如有这样的xml
<node attribute1="a" attribute2="b" value="1"/>
<node attribute1="a" attribute2="c" value="2"/>
<node attribute1="d" attribute2="e" value="3"/>

我想用document.selectsinglenode查找attribute1为a,attribute2为c的节点,
根据一个属性查的会写,两个的不会写啊
SelectSingleNode("node[@attribute1='a']")

坐井观天的主页 坐井观天 | 初学一级 | 园豆:26
提问于:2009-04-08 09:34
< >
分享
最佳答案
0

SelectSingleNode("node[@attribute1='a' and @attribute2='c']")

更多语法可以参考 http://www.w3school.com.cn/xpath/xpath_operators.asp

凉拌苦瓜 | 初学一级 |园豆:195 | 2009-04-08 10:01
其他回答(1)
0

在结果集里再写

SelectSingleNode("node[@attribute1='c']")

水木 | 园豆:12 (初学一级) | 2009-04-08 10:02
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册