title: DOM getElementsByTagName() returning Nodes with NULL Values
body: <p>I have an XML file as follows.</p>
  
  <p>When I use <code>getElementsByTagName("LEVEL2_ID")</code>, I do get a <code>NodeList</code> with <code>Nodes</code>, but those Nodes have NULL values (in other words, <code>getNodeValue()</code> on each result node will return <code>NULL</code>). Why is this? I need to get the contents value of each node, in this case <code>2000</code>.</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;Root&gt;
      &lt;Date&gt;01/17/2012&lt;/Date&gt;
      &lt;LEVEL1&gt;
          &lt;LEVEL1_ID&gt;1000&lt;/LEVEL1_ID&gt;
  
          &lt;LEVEL2&gt;
             &lt;LEVEL2_ID&gt;2000&lt;/LEVEL2_ID&gt;
          &lt;/LEVEL2&gt;
      &lt;/LEVEL1&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>In Java, printing the <strong>Value</strong> of the 1st node obtained with <strong>getElementsByTagName()</strong> returns <strong>NULL</strong>:</p>
  
  <pre><code>NodeList nodes = document.getElementsByTagName("LEVEL2_ID");
  
  System.out.println("Value of 1st node: " + nodes.item(0).getNodeValue());
  </code></pre>