Hi all,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ABC="http://www.ABCSPGM.DSUPFREQ.Request.com">
<soapenv:Header>
<ABC:ABCSHeader>
<ID>xyz</ID>
<ConsumerTransactionId>5667</ConsumerTransactionId>
</ABC:ABCSHeader>
</soapenv:Header>
<soapenv:Body>
<ABC:ABCSPGMOperation>
<ABC:req>
<ABC:plastic_number>1234</ABC:plastic_number>
</ABC:req>
</ABC:ABCSPGMOperation>
</soapenv:Body>
</soapenv:Envelope>

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']

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?

//ABC:plastic_number

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