title: XPath to select nodes in different namespaces
body: <p><strong>I need some help with coming up with a proper XPath expression to extract values out of the XML.</strong></p>
  
  <p>I can get the values using jaxb however I need xpath because I have a decision table kind of mapping rules that I want to externalise, which if I use jaxb will result in lot of nested if/else statements that I want to avoid and hence the need for xpath approach.</p>
  
  <p>I have an xml file that is constructed off at least 4 schemas. I mean the root schema has an element at a particular point that says xs:any and at this location a xml based off a different schema is injected and this in turn has a similar xs:any where another xml is injected to build the final/actual xml that i work with.</p>
  
  <p>This is the actual XML structure that I'm dealing with (I have intentionally modified the values).<strong>The two Document nodes in the xml below are based off different schemas</strong> </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="CDTS-SUBMIT"&gt;
    &lt;env:Body&gt;
      &lt;cdtPrefix&gt;
        &lt;cdtprVersion&gt;01&lt;/cdtprVersion&gt;
        &lt;cdtprOperation&gt;SUBMIT&lt;/cdtprOperation&gt;
        &lt;cdtprFunction&gt;GCAMS1O&lt;/cdtprFunction&gt;
        &lt;cdtprDirectionFlag&gt;O&lt;/cdtprDirectionFlag&gt;
      &lt;/cdtPrefix&gt;
      &lt;cdtDataDescription&gt;
        &lt;cdtddVersion&gt;01&lt;/cdtddVersion&gt;
        &lt;cdtddFirmId&gt;ABC&lt;/cdtddFirmId&gt;
        &lt;cdtddBusinessDataFormat&gt;GCAMS1O-XML&lt;/cdtddBusinessDataFormat&gt;
        &lt;cdtddReferenceNum&gt;123&lt;/cdtddReferenceNum&gt;
        &lt;cdtddTrackingNum&gt;123&lt;/cdtddTrackingNum&gt;
        &lt;cdtddDestination&gt;AQ&lt;/cdtddDestination&gt;
        &lt;cdtddSeqNum&gt;0000000&lt;/cdtddSeqNum&gt;
        &lt;cdtddCycleNum&gt;00&lt;/cdtddCycleNum&gt;
        &lt;cdtddBusinessDate&gt;00000000&lt;/cdtddBusinessDate&gt;
      &lt;/cdtDataDescription&gt;
      &lt;cdtBusinessData&gt;
        &lt;AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
          &lt;Fr&gt;
            &lt;FIId&gt;
              &lt;FinInstnId&gt;
                &lt;BICFI&gt;ABC&lt;/BICFI&gt;
              &lt;/FinInstnId&gt;
            &lt;/FIId&gt;
          &lt;/Fr&gt;
          &lt;To&gt;
            &lt;FIId&gt;
              &lt;FinInstnId&gt;
                &lt;BICFI&gt;ABC   &lt;/BICFI&gt;
              &lt;/FinInstnId&gt;
            &lt;/FIId&gt;
          &lt;/To&gt;
          &lt;BizMsgIdr&gt;ABC&lt;/BizMsgIdr&gt;
          &lt;MsgDefIdr&gt;seev.031.002.05&lt;/MsgDefIdr&gt;
          &lt;BizSvc&gt;CSD&lt;/BizSvc&gt;
          &lt;CreDt&gt;9999-99-99T00:02:17Z&lt;/CreDt&gt;
        &lt;/AppHdr&gt;
        &lt;Document xmlns="urn:swift:xsd:seev.031.002.05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
          &lt;CorpActnNtfctn&gt;
            &lt;NtfctnGnlInf&gt;
              &lt;NtfctnTp&gt;REPL&lt;/NtfctnTp&gt;
              &lt;PrcgSts&gt;
                &lt;Cd&gt;
                  &lt;EvtCmpltnsSts&gt;COMP&lt;/EvtCmpltnsSts&gt;
                  &lt;EvtConfSts&gt;CONF&lt;/EvtConfSts&gt;
                &lt;/Cd&gt;
              &lt;/PrcgSts&gt;
            &lt;/NtfctnGnlInf&gt;
            &lt;PrvsNtfctnId&gt;
              &lt;Id&gt;00000000&lt;/Id&gt;
            &lt;/PrvsNtfctnId&gt;
            &lt;EvtsLkg&gt;
              &lt;EvtId&gt;
                &lt;LkdOffclCorpActnEvtId&gt;US8&lt;/LkdOffclCorpActnEvtId&gt;
              &lt;/EvtId&gt;
              &lt;LkgTp&gt;
                &lt;Cd&gt;INFO&lt;/Cd&gt;
              &lt;/LkgTp&gt;
            &lt;/EvtsLkg&gt;
            &lt;CorpActnGnlInf&gt;
              &lt;CorpActnEvtId&gt;000&lt;/CorpActnEvtId&gt;
              &lt;OffclCorpActnEvtId&gt;US7&lt;/OffclCorpActnEvtId&gt;
              &lt;EvtPrcgTp&gt;
                &lt;Cd&gt;DISN&lt;/Cd&gt;
              &lt;/EvtPrcgTp&gt;
              &lt;EvtTp&gt;
                &lt;Cd&gt;INTR&lt;/Cd&gt;
              &lt;/EvtTp&gt;
              &lt;MndtryVlntryEvtTp&gt;
                &lt;Cd&gt;CHOS&lt;/Cd&gt;
              &lt;/MndtryVlntryEvtTp&gt;
              &lt;UndrlygScty&gt;
                &lt;FinInstrmId&gt;
                  &lt;OthrId&gt;
                    &lt;Id&gt;J54675AA1&lt;/Id&gt;
                    &lt;Tp&gt;
                      &lt;Cd&gt;CUSP&lt;/Cd&gt;
                    &lt;/Tp&gt;
                  &lt;/OthrId&gt;
                  &lt;Desc&gt;JASDFKASDFADSFAFADSF&lt;/Desc&gt;
                &lt;/FinInstrmId&gt;
                &lt;ClssfctnTp&gt;
                  &lt;ClssfctnFinInstrm&gt;DBXXXX&lt;/ClssfctnFinInstrm&gt;
                &lt;/ClssfctnTp&gt;
              &lt;/UndrlygScty&gt;
            &lt;/CorpActnGnlInf&gt;
            &lt;AcctDtls&gt;
              &lt;ForAllAccts&gt;
                &lt;IdCd&gt;GENR&lt;/IdCd&gt;
              &lt;/ForAllAccts&gt;
            &lt;/AcctDtls&gt;
            &lt;CorpActnDtls&gt;
              &lt;DtDtls&gt;
                &lt;RcrdDt&gt;
                  &lt;Dt&gt;
                    &lt;Dt&gt;0000-04-03&lt;/Dt&gt;
                  &lt;/Dt&gt;
                &lt;/RcrdDt&gt;
              &lt;/DtDtls&gt;
              &lt;RateAndAmtDtls&gt;
                &lt;Intrst&gt;
                  &lt;Rate&gt;0&lt;/Rate&gt;
                &lt;/Intrst&gt;
              &lt;/RateAndAmtDtls&gt;
              &lt;IntrstAcrdNbOfDays&gt;0&lt;/IntrstAcrdNbOfDays&gt;
            &lt;/CorpActnDtls&gt;
            &lt;CorpActnOptnDtls&gt;
              &lt;OptnNb&gt;001&lt;/OptnNb&gt;
              &lt;OptnTp&gt;
                &lt;Cd&gt;CASH&lt;/Cd&gt;
              &lt;/OptnTp&gt;
              &lt;DfltPrcgOrStgInstr&gt;
                &lt;DfltOptnInd&gt;true&lt;/DfltOptnInd&gt;
              &lt;/DfltPrcgOrStgInstr&gt;
              &lt;DtDtls&gt;
                &lt;RspnDdln&gt;
                  &lt;Dt&gt;
                    &lt;DtTm&gt;0000-04-10T20:00:00-04:00&lt;/DtTm&gt;
                  &lt;/Dt&gt;
                &lt;/RspnDdln&gt;
              &lt;/DtDtls&gt;
              &lt;PrdDtls&gt;
                &lt;ActnPrd&gt;
                  &lt;Prd&gt;
                    &lt;StartDt&gt;
                      &lt;Dt&gt;
                        &lt;DtTm&gt;0000-04-06T00:00:00-04:00&lt;/DtTm&gt;
                      &lt;/Dt&gt;
                    &lt;/StartDt&gt;
                    &lt;EndDt&gt;
                      &lt;NotSpcfdDt&gt;UKWN&lt;/NotSpcfdDt&gt;
                    &lt;/EndDt&gt;
                  &lt;/Prd&gt;
                &lt;/ActnPrd&gt;
              &lt;/PrdDtls&gt;
              &lt;CshMvmntDtls&gt;
                &lt;CdtDbtInd&gt;CRDT&lt;/CdtDbtInd&gt;
                &lt;IncmTp&gt;
                  &lt;Id&gt;0004&lt;/Id&gt;
                  &lt;Issr&gt;IRSX&lt;/Issr&gt;
                &lt;/IncmTp&gt;
                &lt;DtDtls&gt;
                  &lt;PmtDt&gt;
                    &lt;Dt&gt;
                      &lt;Dt&gt;0000-04-18&lt;/Dt&gt;
                    &lt;/Dt&gt;
                  &lt;/PmtDt&gt;
                &lt;/DtDtls&gt;
                &lt;RateAndAmtDtls&gt;
                  &lt;IntrstRateUsdForPmt&gt;
                    &lt;RateTpAndAmtAndRateSts&gt;
                      &lt;RateTp&gt;
                        &lt;Cd&gt;SCHD&lt;/Cd&gt;
                      &lt;/RateTp&gt;
                      &lt;Amt Ccy="USD"&gt;21.17125&lt;/Amt&gt;
                    &lt;/RateTpAndAmtAndRateSts&gt;
                  &lt;/IntrstRateUsdForPmt&gt;
                  &lt;WhldgOfLclTax&gt;
                    &lt;Rate&gt;15.315&lt;/Rate&gt;
                  &lt;/WhldgOfLclTax&gt;
                &lt;/RateAndAmtDtls&gt;
              &lt;/CshMvmntDtls&gt;
            &lt;/CorpActnOptnDtls&gt;
            &lt;CorpActnOptnDtls&gt;
              &lt;OptnNb&gt;002&lt;/OptnNb&gt;
              &lt;OptnTp&gt;
                &lt;Cd&gt;CASH&lt;/Cd&gt;
              &lt;/OptnTp&gt;
              &lt;OptnFeatrs&gt;
                &lt;Cd&gt;ASVO&lt;/Cd&gt;
              &lt;/OptnFeatrs&gt;
              &lt;DfltPrcgOrStgInstr&gt;
                &lt;DfltOptnInd&gt;false&lt;/DfltOptnInd&gt;
              &lt;/DfltPrcgOrStgInstr&gt;
              &lt;DtDtls&gt;
                &lt;RspnDdln&gt;
                  &lt;Dt&gt;
                    &lt;DtTm&gt;0000-04-10T20:00:00-04:00&lt;/DtTm&gt;
                  &lt;/Dt&gt;
                &lt;/RspnDdln&gt;
              &lt;/DtDtls&gt;
              &lt;PrdDtls&gt;
                &lt;ActnPrd&gt;
                  &lt;Prd&gt;
                    &lt;StartDt&gt;
                      &lt;Dt&gt;
                        &lt;DtTm&gt;0000-04-06T00:00:00-04:00&lt;/DtTm&gt;
                      &lt;/Dt&gt;
                    &lt;/StartDt&gt;
                    &lt;EndDt&gt;
                      &lt;NotSpcfdDt&gt;UKWN&lt;/NotSpcfdDt&gt;
                    &lt;/EndDt&gt;
                  &lt;/Prd&gt;
                &lt;/ActnPrd&gt;
              &lt;/PrdDtls&gt;
              &lt;CshMvmntDtls&gt;
                &lt;CdtDbtInd&gt;CRDT&lt;/CdtDbtInd&gt;
                &lt;IncmTp&gt;
                  &lt;Id&gt;0004&lt;/Id&gt;
                  &lt;Issr&gt;IRSX&lt;/Issr&gt;
                &lt;/IncmTp&gt;
                &lt;DtDtls&gt;
                  &lt;PmtDt&gt;
                    &lt;Dt&gt;
                      &lt;Dt&gt;0000-04-18&lt;/Dt&gt;
                    &lt;/Dt&gt;
                  &lt;/PmtDt&gt;
                &lt;/DtDtls&gt;
                &lt;RateAndAmtDtls&gt;
                  &lt;IntrstRateUsdForPmt&gt;
                    &lt;RateTpAndAmtAndRateSts&gt;
                      &lt;RateTp&gt;
                        &lt;Cd&gt;SCHD&lt;/Cd&gt;
                      &lt;/RateTp&gt;
                      &lt;Amt Ccy="USD"&gt;25&lt;/Amt&gt;
                    &lt;/RateTpAndAmtAndRateSts&gt;
                  &lt;/IntrstRateUsdForPmt&gt;
                  &lt;WhldgOfLclTax&gt;
                    &lt;Rate&gt;0&lt;/Rate&gt;
                  &lt;/WhldgOfLclTax&gt;
                &lt;/RateAndAmtDtls&gt;
              &lt;/CshMvmntDtls&gt;
            &lt;/CorpActnOptnDtls&gt;
            &lt;AddtlInf&gt;
              &lt;AddtlTxt&gt;
                &lt;UpdDt&gt;0000-04-04&lt;/UpdDt&gt;
                &lt;AddtlInf&gt; adfafadfasdfasdfasdfsdafadfdsafdf&lt;/AddtlInf&gt;
              &lt;/AddtlTxt&gt;
            &lt;/AddtlInf&gt;
            &lt;Regar&gt;
              &lt;NmAndAdr&gt;
                &lt;Nm&gt;Not Available&lt;/Nm&gt;
              &lt;/NmAndAdr&gt;
            &lt;/Regar&gt;
            &lt;SplmtryData&gt;
              &lt;Envlp&gt;
                &lt;Document xmlns="urn:swift:xsd:supl.001.001.05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
                  &lt;DTCCCANOCSDDataSD1&gt;
                    &lt;NtfctnGnlInf&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/NtfctnGnlInf&lt;/PlcAndNm&gt;
                      &lt;CretDtAndTm&gt;0000-04-24T11:34:09&lt;/CretDtAndTm&gt;
                      &lt;UpdDtAndTm&gt;0000-04-24T20:02:16&lt;/UpdDtAndTm&gt;
                    &lt;/NtfctnGnlInf&gt;
                    &lt;CorpActnGnlInf&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnGnlInf&lt;/PlcAndNm&gt;
                      &lt;EDSMsggElgbltyFlg&gt;true&lt;/EDSMsggElgbltyFlg&gt;
                      &lt;DTCFCPElctnFlg&gt;false&lt;/DTCFCPElctnFlg&gt;
                      &lt;AsstSvcrPrcgFlg&gt;true&lt;/AsstSvcrPrcgFlg&gt;
                    &lt;/CorpActnGnlInf&gt;
                    &lt;UndrlygScty&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnGnlInf/UndrlygScty&lt;/PlcAndNm&gt;
                      &lt;CtryOfListg&gt;DE&lt;/CtryOfListg&gt;
                      &lt;IncmSrcCtry&gt;JP&lt;/IncmSrcCtry&gt;
                      &lt;DTCAsstClss&gt;CRPB&lt;/DTCAsstClss&gt;
                      &lt;DTCAsstTp&gt;S500&lt;/DTCAsstTp&gt;
                    &lt;/UndrlygScty&gt;
                    &lt;CorpActnDtls&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnDtls&lt;/PlcAndNm&gt;
                      &lt;CutOffDays&gt;0&lt;/CutOffDays&gt;
                      &lt;EDSMsggCtryCd&gt;JP&lt;/EDSMsggCtryCd&gt;
                      &lt;RDPRefNb&gt;yyyyyyJ54675xxxxxxxxxxxxxxxxxxxx&lt;/RDPRefNb&gt;
                    &lt;/CorpActnDtls&gt;
                    &lt;CorpActnDtDtls&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnDtls/DtDtls&lt;/PlcAndNm&gt;
                      &lt;DTCPosCaptrDt&gt;0000-04-03&lt;/DTCPosCaptrDt&gt;
                    &lt;/CorpActnDtDtls&gt;
                    &lt;OptnDtls&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnOptnDtls[1]&lt;/PlcAndNm&gt;
                      &lt;XtndedOptnFeatrs&gt;FORU&lt;/XtndedOptnFeatrs&gt;
                      &lt;DfltOptnFlg&gt;true&lt;/DfltOptnFlg&gt;
                      &lt;RDPRefNb&gt;yyyyyyJ54675xxxxxxxxxxxxxxxxxxxx&lt;/RDPRefNb&gt;
                    &lt;/OptnDtls&gt;
                    &lt;OptnDtls&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnOptnDtls[2]&lt;/PlcAndNm&gt;
                      &lt;XtndedOptnFeatrs&gt;FORX&lt;/XtndedOptnFeatrs&gt;
                      &lt;RDPRefNb&gt;yyyyyyJ54675xxxxxxxxxxxxxxxxxxxx&lt;/RDPRefNb&gt;
                    &lt;/OptnDtls&gt;
                    &lt;CshMvmntDtls&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnOptnDtls[1]/CshMvmntDtls[1]&lt;/PlcAndNm&gt;
                      &lt;DTCPayMtd&gt;1&lt;/DTCPayMtd&gt;
                      &lt;DTCPayOrdr&gt;0&lt;/DTCPayOrdr&gt;
                      &lt;NRATaxRptblFlg&gt;false&lt;/NRATaxRptblFlg&gt;
                      &lt;DclrdGrssRate&gt;
                        &lt;AmtPricPerFinInstrmQty&gt;
                          &lt;AmtPricTp&gt;ACTU&lt;/AmtPricTp&gt;
                          &lt;PricVal Ccy="USD"&gt;25&lt;/PricVal&gt;
                          &lt;FinInstrmQty&gt;
                            &lt;FaceAmt&gt;1000&lt;/FaceAmt&gt;
                          &lt;/FinInstrmQty&gt;
                        &lt;/AmtPricPerFinInstrmQty&gt;
                      &lt;/DclrdGrssRate&gt;
                      &lt;RDPRefNb&gt;yyyyyyJ54675xxxxxxxxxxxxxxxxxxxx&lt;/RDPRefNb&gt;
                    &lt;/CshMvmntDtls&gt;
                    &lt;CshMvmntDtls&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/CorpActnOptnDtls[2]/CshMvmntDtls[1]&lt;/PlcAndNm&gt;
                      &lt;DTCPayMtd&gt;1&lt;/DTCPayMtd&gt;
                      &lt;DTCPayOrdr&gt;0&lt;/DTCPayOrdr&gt;
                      &lt;NRATaxRptblFlg&gt;false&lt;/NRATaxRptblFlg&gt;
                      &lt;RDPRefNb&gt;yyyyyyJ54675xxxxxxxxxxxxxxxxxxxx&lt;/RDPRefNb&gt;
                    &lt;/CshMvmntDtls&gt;
                    &lt;Agt&gt;
                      &lt;PlcAndNm&gt;/Document/CorpActnNtfctn/Regar/NmAndAdr&lt;/PlcAndNm&gt;
                      &lt;AgtId&gt;00009910&lt;/AgtId&gt;
                    &lt;/Agt&gt;
                  &lt;/DTCCCANOCSDDataSD1&gt;
                &lt;/Document&gt;
              &lt;/Envlp&gt;
            &lt;/SplmtryData&gt;
          &lt;/CorpActnNtfctn&gt;
        &lt;/Document&gt;
      &lt;/cdtBusinessData&gt;
    &lt;/env:Body&gt;
  &lt;/env:Envelope&gt;
  </code></pre>
  
  <p><strong>I have no problems extracting the first few elements
  like /env:Envelope/env:Body/cdtBusinessData</strong></p>
  
  <p><strong>the cdtBusinessData is the element in the main schema that takes a xs:any</strong>
  .The schema snippet is as follows</p>
  
  <pre><code>                &lt;xs:element name="cdtBusinessData" form="unqualified"&gt;
                      &lt;xs:complexType&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:any minOccurs="0"/&gt;
                          &lt;/xs:sequence&gt;
                      &lt;/xs:complexType&gt;
                  &lt;/xs:element&gt;
  </code></pre>
  
  <p>Precisely from this point on my xpath queries don't work the way I expect them to.</p>
  
  <p>i.e <strong>when I try /env:Envelope/env:Body/cdtBusinessData/Document then it doesn't identify it to be a proper path on jxpath</strong>.
  On different tools that provide a xpath(like xpather/firepath/XpathBuilder) for a selected node I get different values,none of which are accepted by xpath.</p>
  
  <p>Could you please help me in understanding how I can go about extracting values from the two embedded  nodes in the above xml.</p>
  
  <p>I have struggled with this for quite sometime now and finally reaching out for help here.
  Would appreciate if you can help me to correct this path
  <strong>//env:Envelope/env:Body/cdtBusinessData/<em>Document</em></strong></p>
  
  <hr>
  
  <h2>UPDATE</h2>
  
  <blockquote>
    <p>This is what I came up with based on your suggestions.I'm using
    jxpath
     1.3. What am I doing wrong here ? I have comments inline next to the sysouts to indicate what I get</p>
  </blockquote>
  
  <pre><code>package com.testbed;
  
  import java.io.ByteArrayInputStream;
  
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  
  import org.apache.commons.jxpath.JXPathContext;
  
  import com.xyz.ib.pb.dtcc.util.FileUtils;
  
  public class TestJXPathApproach {
  
      public static void main(String a[]) throws Exception {              
          String xmlMsg = FileUtils.readFileContents("C:\\dtcc-stuff\\SR\\1.xml");
          //xmlMsg = StringUtils.remove(xmlMsg, "&lt;?xml version=\"1.0\"?&gt;");
          TestJXPathApproach myTest = new TestJXPathApproach();
          myTest.testJxPathExpressions(xmlMsg);
      }
  
      private void testJxPathExpressions(String xmlMsg) {
          org.w3c.dom.Document doc = null;
          try {
              DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
              ByteArrayInputStream bais = new ByteArrayInputStream(xmlMsg.getBytes("UTF8"));
              doc = builder.parse(bais);
              bais.close();
              JXPathContext context = JXPathContext.newContext(doc);
              context.setLenient(true);
              context.registerNamespace("d", "urn:swift:xsd:seev.031.002.05");
              context.registerNamespace("dd", "urn:swift:xsd:supl.001.001.05");
  
  
              String cdtddTrackingNumVal = (String)context.getValue("/env:Envelope/env:Body/cdtDataDescription/cdtddTrackingNum");
              System.out.println("cdtddTrackingNumVal : "+cdtddTrackingNumVal); // prints the value correctly
  
  
              String cdVal = (String)context.getValue("/env:Envelope/env:Body/cdtBusinessData/d:Document/CorpActnNtfctn/CorpActnGnlInf/EvtTp/Cd");
              System.out.println("cdVal : "+cdVal);// prints null with namespace mappping specified
  
              cdVal = (String)context.getValue("/env:Envelope/env:Body/cdtBusinessData/Document/CorpActnNtfctn/CorpActnGnlInf/EvtTp/Cd");
              System.out.println("cdVal : "+cdVal);// prints null with no namespace mapping 
  
              cdVal = (String)context.getValue("/env:Envelope/env:Body/cdtBusinessData/*:Document/CorpActnNtfctn/CorpActnGnlInf/EvtTp/Cd");
              System.out.println("cdVal : "+cdVal);// prints null with wildcard namespace mapping 
  
              Object nodeObj  = context.selectSingleNode("/env:Envelope/env:Body/cdtBusinessData/d:Document/CorpActnNtfctn");
              System.out.println("nodeObj : "+nodeObj);// prints null
  
  
          }catch(Exception e) {
              e.printStackTrace();
          }
      }
  
  }
  </code></pre>