XPath评估失败

时间:2017-10-19 15:19:33

标签: xpath

在Price?

下获取所有节点所需的Xpath代码是什么?

到目前为止,我已经尝试AMUpdate/AMMesageType/amprice/Price,这是失败的。

<AMUpdate>
    <AMMessageType>AMPRICES</AMMessageType>
    <amprice:AMPrices xmlns:amprice="http://www/am.com/am/dto/price">
        <Price>
            <Currency>GBP</Currency>
            <Country>LU</Country>
            <BusinessLine>AMSL</BusinessLine>
        </Price>
    </amprice:AMPrices>
</AMUpdate>

1 个答案:

答案 0 :(得分:2)

请在Xpath下面尝试,

/AMUpdate/amprice:AMPrices/Price/*

您的XML缺少结束标记。请找到更新的XML,

&#13;
&#13;
<AMUpdate>
  <AMMessageType>AMPRICES</AMMessageType>
  <amprice:AMPrices xmlns:amprice="http://www/am.com/am/dto/price">
    <Price>
      <Currency>GBP</Currency>
      <Country>LU</Country>
      <BusinessLine>AMSL</BusinessLine>
    </Price>
    </amprice:AMPrices>
</AMUpdate>
&#13;
&#13;
&#13;

您可以尝试测试XPath here