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

最佳答案

请在Xpath下尝试,

/AMUpdate/amprice:AMPrices/Price/*


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



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





您可以尝试测试XPath here

09-26 01:19