1

What would be the Xpath code required to get all of the nodes under Price?

So far I have tried AMUpdate/AMMesageType/amprice/Price, which is failing.

<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>
methuselah
  • 12,766
  • 47
  • 165
  • 315

1 Answers1

2

Please try below Xpath,

/AMUpdate/amprice:AMPrices/Price/*

You XML have a closing tag missing. Please find the updated 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>

You can try testing XPath here

Vijayanath Viswanathan
  • 8,027
  • 3
  • 25
  • 43