0

I have the following XML:

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"         xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
     <a:Action s:mustUnderstand="1">http:///version1/IItemSaleService     /NewCartForTransactionsResponse</a:Action>
      <ActivityId xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics" CorrelationId="7ccc7b80-b4e8-4fd2-ae61-625b06870191">5b379c02-9288-4e5a-a993-076bf575e5dc</ActivityId>
 </s:Header>
 <s:Body>
 <NewCartForTransactionsResponse xmlns="sservice/itemsale/version1">
<NewCartForTransactionsResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ActionCodes/>
<Cart>
    <BarCodeData>22100245107700005684000000002610153</BarCodeData>
    <CartId>
        <HashBasedMessageAuthenticationCode>42</HashBasedMessageAuthenticationCode>
        <ID>1012451-77-5684</ID>
      ....
</s:Envelope>

And I want to get the value of the node (1012451-77-5684).

Using

//ID[0]/text()

does not work.

Any tips?

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
Magnus Jensen
  • 905
  • 6
  • 36
  • 73

2 Answers2

0

Try to use XPath local-name

//*[local-name()='ID']

Anton
  • 1,051
  • 1
  • 9
  • 21
0

How this works, what was final syntax that works?

You use... .check(xpath("///text()").find.saveAs("id"))

instead of ... .check(xpath("//ID[0]/text()").find.saveAs("id"))