2

如果属性中有任何值“失败”,我如何构建 XPath 表达式测试?

例如,对于这个 XML,它应该返回“TRUE”

<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>

为此,它应该返回“FALSE”

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

提前致谢!

4

1 回答 1

2

文档在这里 Function: boolean boolean(object)

是的可能:-

boolean(//Property[.='fail'])

您的第一个 xml 的上述表达式将返回true,第二个 xml 将返回false

于 2013-09-06T15:27:18.167 回答