What should be the correct XML xpath? -


here's xml document.

<?xml version="1.0" encoding="utf-8"?> <env:envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mtc="otc_matching_11-0" xmlns:rm="otc_rm_11-0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="otc_rm_11-0 /xmls/otc/otc_rm_11-0.xsd  otc_matching_11-0  /xmls/otc/otc_matching_11-0.xsd                           http://schemas.xmlsoap.org/soap/envelope/ /xmls/otc/soap-envelope.xsd  "> <env:header>   <otc_rm xmlns="otc_rm_11-0">      <manifest>         <trademsg>            <activity>new</activity>            <status>submit</status>         </trademsg>      </manifest>   </otc_rm> </env:header> </env:envelope> 

shouldn't xpath activity be:

/env:envelope/env:header/rm:otc_rm/rm:manifest/rm:trademsg/rm:activity 

i doesn't work. tried here

what issue?

you can choose local-name() function address default namespace. try this:

/env:envelope/env:header/*[local-name()='otc_rm']/*[local-name()='manifest']/*[local-name()='trademsg']/*[local-name()='activity'] 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -