我的xml结构是这样的<list>
<item>
<id>1</id>
<type>type1</type>
<bdxh>1</bdxh>
<mbbh>QWEE</mbbh>
<bjsj>2010/2/12</bjsj>
<fj>具体选项</fj>
</item>
<item>
<id>1</id>
<type>type2</type>
<bdxh>2</bdxh>
<mbbh>FDFF</mbbh>
<bjsj>2009/2/14</bjsj>
<fj>无</fj>
</item> </list>
我用List<Element> elements=selectNodes("/list/item[id>0]/type")进行查询的时候结果集只返回了type2,按说应该返回两个结果。结果只返回了第二个item中的type2,Node中还有个双参数的SlectNodes(String xpathExpression,String comparisonXPathExpression)方法,他的API文档中意思是第二个参数是以Xpath的语法格式插入一个XpathExpression用来区分结果集中的多条数据。求教高手这个是怎么用的,感激不尽。
<item>
<id>1</id>
<type>type1</type>
<bdxh>1</bdxh>
<mbbh>QWEE</mbbh>
<bjsj>2010/2/12</bjsj>
<fj>具体选项</fj>
</item>
<item>
<id>1</id>
<type>type2</type>
<bdxh>2</bdxh>
<mbbh>FDFF</mbbh>
<bjsj>2009/2/14</bjsj>
<fj>无</fj>
</item> </list>
我用List<Element> elements=selectNodes("/list/item[id>0]/type")进行查询的时候结果集只返回了type2,按说应该返回两个结果。结果只返回了第二个item中的type2,Node中还有个双参数的SlectNodes(String xpathExpression,String comparisonXPathExpression)方法,他的API文档中意思是第二个参数是以Xpath的语法格式插入一个XpathExpression用来区分结果集中的多条数据。求教高手这个是怎么用的,感激不尽。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货