【发布时间】:2013-01-26 01:59:41
【问题描述】:
我可以使用在线 xpath 工具使下面的 xpath 与下面的 xml 一起工作,但我得到一个“表达式必须评估为节点集”。 .NET 4.5 中的异常
xpath:
//*[starts-with(name(.), "childnode")[identification/text()='xyz']]
xml:
<rootnode>
<childnode1234>
<identification>xyz</identification>
</childnode1234>
<childnode3456>
<identification>abc</identification>
</childnode3456>
</rootnode>
预期的结果是
<childnode1234>
<identification>xyz</identification>
</childnode1234>
【问题讨论】:
-
您使用哪些在线工具?他们返回什么?
-
您是否正确复制了 XPath?最后的
";是什么意思? -
请显示真实的 C#
string- 现在它包含非转义双引号... -
我试过的测试人员是:xpathtester.com/test & freeformatter.com/xpath-tester.html。我正在转义“ with \”。预期结果是:
xyz