昨天为了获取xml中指定值的节点信息,使用xpath查找数据,google了一圈终于找到了写法。xml如下:

<Properties>
<Property Descriptor="100">1377349460.298</Property>
<Property Descriptor="101">1</Property>
<Property Descriptor="24000">fail</Property>
</Properties>
<Properties>
<Property Descriptor="100">1377349462.298</Property>
<Property Descriptor="101">1</Property>
<Property Descriptor="24000">pass</Property>
</Properties>

比如上面的xml 我要获取
Property节点值为fail的节点信息。

C# 中使用xpath :
XmlNode xmlnoderesult = doc.SelectSingleNode("//
Property[text()='fail']");
 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2022-01-05
  • 2022-12-23
猜你喜欢
  • 2021-08-28
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-12-14
  • 2022-12-23
相关资源
相似解决方案