Page 1 of 1

Reading XML and namespace prefixes

Posted: Wed Feb 25, 2015 9:47 am
by jlous
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