title: XPATH better way to parse xml
body: <p>What is the better way to parse such xml:</p>
  
  <pre><code>&lt;FindLicensesResponse xmlns="http://abc.com"&gt;
  &lt;FindLicensesResult&gt;
      &lt;Licensies&gt;
          &lt;ActivityLicense&gt;
              &lt;id&gt;1&lt;/id&gt;
              &lt;DateIssue&gt;2011-12-29T00:00:00&lt;/DateIssue&gt;
              &lt;ActivityType xmlns:s01="http://www.w3.org/2001/XMLSchema-instance" s01:type="ActivityType"&gt;
                  &lt;code&gt;somecode1&lt;/code&gt;
              &lt;/ActivityType&gt;
              &lt;ActivityTerritory xmlns:s02="http://www.w3.org/2001/XMLSchema-instance" s02:type="Territory"&gt;
                  &lt;code&gt;somecode2&lt;/code&gt;
              &lt;/ActivityTerritory&gt;
              &lt;ActivityLicenseAttachments /&gt;
          &lt;/ActivityLicense&gt;
          &lt;ActivityLicense&gt;
              &lt;id&gt;2&lt;/id&gt;
              &lt;DateIssue&gt;2011-12-21T00:00:00&lt;/DateIssue&gt;
              &lt;ActivityType xmlns:s01="http://www.w3.org/2001/XMLSchema-instance" s01:type="ActivityType"&gt;
                  &lt;code&gt;somecode3&lt;/code&gt;
              &lt;/ActivityType&gt;
              &lt;ActivityTerritory xmlns:s02="http://www.w3.org/2001/XMLSchema-instance" s02:type="Territory"&gt;
                  &lt;code&gt;somecode4&lt;/code&gt;
              &lt;/ActivityTerritory&gt;
              &lt;ActivityLicenseAttachments /&gt;
          &lt;/ActivityLicense&gt;
      &lt;/Licensies&gt;
  &lt;/FindLicensesResult&gt;
  </code></pre>
  
  <p></p>
  
  <p>I need to get values from each ActivityLicense: id, DateIssue and inner ActivityType: code and inner ActivityTerritory: code.</p>
  
  <p>Now I do it like this:</p>
  
  <pre><code>CachedXPathAPI xpathAPI = new CachedXPathAPI();
  Element nsctx = result.getSOAPPart().createElementNS(null, "nsctx");
  nsctx.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:el","http://abc.com");
  NodeList activityLicenses = xpathAPI.selectNodeList(result.getSOAPPart(),"//el:ActivityLicense", nsctx);
  
  for (int i = 0; i &lt; activityLicenses.getLength(); i++) {
      Node id = xpathAPI.selectSingleNode(activityLicenses.item(i), "//el:id", nsctx);
      Node dateIssue = xpathAPI.selectSingleNode(activityLicenses.item(i), "//el:DateIssue",nsctx);
  
      System.out.println("id: " + id.getTextContent());
      System.out.println("dateIssue: " + dateIssue.getTextContent());
  }
  </code></pre>
  
  <p>But I can't get values from ActivityType/code and ActivityTerritory/code</p>