我正在为XPath尝试的XML
<Life Version="2.24.0" xmlns="http://A.org/Life/2">
<LifeResponse id="Response_001">
<TransRefGUID>3b6418ef-0010-4f81-b67a-bd60db693e76</TransRefGUID>
<TransResult>
<ResultCode tc="5">Failed</ResultCode>
<ConfirmationID />
<RecordsFound>0</RecordsFound>
</TransResult>
</LifeResponse>
</Life>
我试图使用的Xpath表达式,
Result = xpath(LifeResponse,"/*[local-name()='Life' and namespace-uri()='http://A.org/Life/2']/*[local-name()='LifeResponse' and namespace-uri()='http://A.org/Life/2']/*[local-name()='TransResult' and namespace-uri()='http://A.org/Life/2']/*[local-name()='ResultCode' and namespace-uri()='http://A.org/Life/2']/@tc )");
收到错误:
Inner exception: '/*[local-name()='Life' and namespace-uri()='http://A.org/Life/2']/*[local-name()='LifeResponse' and namespace-uri()='http://A.org/Life/2']/*[local-name()='TransResult' and namespace-uri()='http://A.org/Life/2']/*[local-name()='ResultCode' and namespace-uri()='http://A.org/Life/2']/@tc )' has an invalid token
要求:
变量“Result”是一个字符串,我试图存储TC属性中的值。
问题:
当我尝试使用在线xpath测试器测试xpath时工作正常但通过BizTalk给出错误,
感谢任何帮助
您是否尝试删除末尾的额外空间如下所示?
之前 - / @ tc)“);
之后 - / @ tc)“);