Get text from XML between tags in Java
<p>I have xml entries like the following. I want to extract everything after the d:index tag closes to the end of entry.</p>

<pre><code>&lt;d:entry id="some_id" d:title="some_title"&gt;
        &lt;d:index d:value="some_value"/&gt;
        &lt;h1&gt;headlines&lt;/h1&gt;

        &lt;p&gt;paragraphs&lt;/p&gt;
        &lt;div&gt;
           &lt;ul&gt;
              &lt;li&gt;lists&lt;/li&gt;

           &lt;/ul&gt;
        &lt;/div&gt;
        text like that
&lt;/d:entry&gt;
</code></pre>

<p>I tried using</p>

<pre><code>dBuilder = dbFactory.newDocumentBuilder();
            Document doc = dBuilder.parse(file);
            doc.getDocumentElement().normalize();
eList = doc.getElementsByTagName("d:entry");
for (int i = 0; i &lt; eList.getLength(); i++){
    Node nNode = eList.item(i);
    textList[i] = nNode.getTextContent();
}
</code></pre>

<p>But, .getTextContent() only gives me 'text like that' and not </p>

<pre><code>&lt;h1&gt;headlines&lt;/h1&gt;

&lt;p&gt;paragraphs&lt;/p&gt;
   &lt;div&gt;
     &lt;ul&gt;
      &lt;li&gt;lists&lt;/li&gt;

     &lt;/ul&gt;
   &lt;/div&gt;
text like that
</code></pre>