0
<?xml version="1.0" encoding="UTF-8"?>
<IDMResponse xmlns="http://www.nrf-arts.org/IXRetail/namespace/" MajorVersion="1" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <ARTSHeader>
        <MessageID>1</MessageID>
        <Response ResponseCode="Ok">
            <RequestID>1</RequestID>
        </Response>
    </ARTSHeader>
</IDMResponse>

I tried
//[local-name() = 'Response'] and @//*[local-name() = 'Response']

2 Answers2

0

To access the <Response ResponseCode="Ok"> node you can use

//Response

To extract the Ok value from there this should work:

//Response/@ResponseCode
Prophet
  • 32,350
  • 22
  • 54
  • 79
0

In stead of

//[local-name() = 'Response']

use

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

The predicate ([]) needs something to filter on.

// selects nothing. It tells to look for any descendant something. But it needs at least a following attribute or node to know what to do.

/* selects the root-node independend of name of element

//* selects all element-nodes independend of name

//@ selects all attributes independend of name

//Response selects all elements with the name Response that are not in a namespace

//*[local-name()='Response'] selects all elements with the name Response independend off a namespace

//*[local-name()='Response' and @ResponseCode='Ok'] selects all elements with the name Response(independend off a namespace) and that have a attribute ResponseCode with the value Ok

Here are some more examples.

And take a look at this answer

Siebe Jongebloed
  • 3,906
  • 2
  • 14
  • 19