Reading XML and namespace prefixes

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
1 post Page 1 of 1

jlous

Posts: 2
Joined: Wed Jan 14, 2015 9:14 am

Post by jlous » Wed Feb 25, 2015 9:47 am
Hi, we need to process a SOAP response XML with namespaces from an external organization. To extract a value it is possible to refer to a column using this path (xpath?):

/s:Envelope/s:Body/IndienenEIRetourbestandenResponse/IndienenEIRetourbestandenResult/a:Resultaat/b:Resultaatcode

However it is not guaranteed that the prefixes will remain "s", "a" and "b". The might become "ns0", "ns1" or "ns2" or whatever. The namespace itself ofcourse will remain correct.
So I tried to ignore namespaces with the following path values, but none of them seem to work:

/Envelope/Body/IndienenEIRetourbestandenResponse/IndienenEIRetourbestandenResult/Resultaat/Resultaatcode

/*[local-name() = 'Envelope']/*[local-name() = 'Body']/*[local-name() = 'IndienenEIRetourbestandenResponse']/*[local-name() = 'IndienenEIRetourbestandenResult']/*[local-name() = 'Resultaat']/*[local-name() = 'Resultaatcode']

//b:Resultaatcode

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

How can we avoid having to change our GoAnywhere projects if the external Organization will change their prefixes? Note that in this case we could get away with ignoring namespaces altogether if there is an option for that.

Cheers,
Joop
1 post Page 1 of 1