Skip to Content
0
Former Member
Apr 25, 2007 at 04:23 PM

namespace-aware XPath expressions?

476 Views

In xMII 11.5.2 b64, I need to extract a node from a SOAP message:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns0:importRequest xmlns:ns0="http://www.acme.com/1.0/schemas">
        <FOO>
        ...

The following xMII Assign action Link returns me the entire <FOO> nodeset:

Transaction.SOAPRequest{/soapenv:Envelope/soapenv:Body/ns0:importRequest/*}

However, I cannot be guaranteed that the namespace prefixes will always be "soapenv" and "ns0". For example, the following is perfectly valid:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP:Header/>
   <SOAP:Body>
      <ZZZ:importRequest xmlns:ZZZ="http://www.acme.com/1.0/schemas">
        <FOO>
        ...

When they are changed the XPath fails. I have tried the following:

Transaction.SOAPRequest{/Envelope/Body/importRequest/*}
Transaction.SOAPRequest{//importRequest/*}

but they clearly don't work because the XPath evaluator in xMII is namespace aware (as it should be).

How can I declare namespaces in my XPath expression? Or are there any other alternate ideas?

Thanks,

-tim