Hi all,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ABC="http://www.ABCSPGM.DSUPFREQ.Request.com">

The above is my input passed by the client. How can I extract the values within the tag 'ID','ConsumerTransactionId' and 'ABC:plastic_number' using simple xpath expressions.

I know that if we give

/*[namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/' and local-name()='Envelope']/*[namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/' and local-name()='Header']/*[namespace-uri()='http://www.ABCSPGM.DSUPFREQ.Request.com' and local-name()='ABCSHeader']/ID
this will fetch me the value of automation id

However instead of the above long expression is there a way to generalize such that I can search for the first occurence of 'ID' and take the value

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

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

7 Years
Discussion Span
Last Post by iceandrews

It works with /*/*/*/ID for ID

Is there a method to get an expression like /*/*/*/ID for plastic-number as well. This has a namespace compared to others.


why not just //ID for the first?


there's nothing to stop from using the fully qualified name in the xpath.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.