title: Null value returnred with XML parsing in java using plane DOM parser
body: <p>I was trying to parse a collada(.dae) file in java using plane DOM parser. When I try to get value it returns me null. I tried with answers and suggestions from other discussions but was not a success. The code I used is below.</p>
  
  <pre><code>for(int k1=0;k1&lt;meshlist.getLength();k1++) {
      Element geometryItr1 = (Element)geometrylist.item(k);
  
      NodeList trianglelist = geometryItr1.getElementsByTagName("triangles");
  
      //System.out.println("Triangles length is " + trianglelist.getLength());     
  
          for(int o=0;o&lt;trianglelist.getLength();o++) {
  
              Element trichildnodes = (Element) trianglelist.item(o);
              NodeList inputs = trichildnodes.getElementsByTagName("input");
          NodeList p = trichildnodes.getElementsByTagName("p");
          Element ppp = (Element) p.item(0);
          System.out.println("Node Value " + ppp.getNodeValue());
          System.out.println(inputs.getLength() + "Input length");
  
          for(int in=0;in&lt;inputs.getLength();in++) {
  
              Element inn = (Element) inputs.item(in);
              System.out.println(inn.getAttribute("semantic") + " " + inn.getAttribute("source") + " Attributes");
  
          }
  
  
          //System.out.println(p.getLength() +  " P's length" );
          //System.out.println("P's content " + ppp.getFirstChild().getNodeValue());
  
  
      }   
  }
  </code></pre>
  
  <p>The XML is very large and I am posting a part which I was trying to parse. </p>
  
  <pre><code>&lt;mesh&gt;
    &lt;source&gt; &lt;/source&gt;
    &lt;source&gt; &lt;/source&gt;
    &lt;source&gt; &lt;/source&gt;
    &lt;triangles&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;p&gt; 24 262 2 72 72 72 72 2222 8198219  &lt;/p&gt;
    &lt;triangles&gt;
    &lt;triangles&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;p&gt; 24 262 2 72 72 72 72 2222 8198219  &lt;/p&gt;
    &lt;triangles&gt;
    &lt;triangles&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;p&gt; 24 262 2 72 72 72 72 2222 8198219  &lt;/p&gt;
    &lt;triangles&gt;
    &lt;triangles&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;input /&gt;
      &lt;p&gt; 24 262 2 72 72 72 72 2222 8198219  &lt;/p&gt;
    &lt;triangles&gt;
  &lt;/mesh&gt;
  </code></pre>
  
  <p>I was trying to get the value of <code>&lt;p&gt;</code>. Everything works fine except getting p's value. But when I debug I can see the values, its associated with first child. I even tried using firstChild. I am completely lost with parsing trying to find out a solution on this. Please some one help me find a solution on How to get the value of p ?</p>
  
  <p>When I use getTextContent instead I get the output like below:</p>
  
  <pre><code>NodeValue null
  NodeValue 24 262 2 72 72 72 72 2222 8198219
  NodeValue null
  </code></pre>
  
  <p>The output is blank for two tags.</p>