c# xpath 获取指定值的写法

昨天为了获取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']");