title: DOM Parser thowing null pointer exception if XML has enclosure tag
body: <p>I am creating an android app to parse an RSS feed and for the past few weeks it has been working well. But recently one of the posts had an <code>&lt;enclosure&gt;</code> tag and the app stopped working and the logcat stated that the DOMParser threw a NullPointerException.<br>
  I went through and tried everything my knowledge of java could possibly do. But to no avail.  </p>
  
  <p><em>As a side note if I manually remove the problematic tag, the problem is solved and the app works fine again.</em></p>
  
  <p><strong>This is the xml that I'm parsing</strong></p>
  
  <pre><code>&lt;item&gt;
  &lt;title&gt;Title&lt;/title&gt;
  &lt;link&gt;Link&lt;/link&gt;
  &lt;pubDate&gt;Sun, 27 Jan 2013 05:08:30 +0000&lt;/pubDate&gt;
  &lt;dc:creator&gt;&lt;/dc:creator&gt;
  &lt;guid isPermaLink="false"&gt;guid&lt;/guid&gt;
  &lt;content:encoded&gt;
  Content
  &lt;/content:encoded&gt;
  &lt;enclosure url="" length="22836034" type="audio/mpeg"/&gt;
  &lt;/item&gt;
  </code></pre>
  
  <p><em>I've removed the un-relevant tags and replaced the information for privacy and the sake of keeping it short</em></p>
  
  <p><strong>And a section of the parser:</strong></p>
  
  <pre><code>Document doc = db.parse(new InputSource(url.openStream()));
              doc.getDocumentElement().normalize();
  
  
              NodeList nl = doc.getElementsByTagName("item");
  
  
  
              int length = nl.getLength();
  
              for (int i = 0; i &lt; length; i++) {
                  Node currentNode = nl.item(i);
                  RSSItem _item = new RSSItem();
  
  
  
  
                  NodeList nchild = currentNode.getChildNodes();
                  int clength = nchild.getLength();
  
  
                  for (int j = 1; j &lt; clength; j = j + 2) {
  
                      Node thisNode = nchild.item(j);
                      String nodeContent = null;
                      String nodeName = thisNode.getNodeName();
  
  
                      nodeContent = nchild.item(j).getFirstChild().getNodeValue();
  </code></pre>
  
  <p>In the logcat it tells me that this line: </p>
  
  <pre><code>nodeContent = nchild.item(j).getFirstChild().getNodeValue();
  </code></pre>
  
  <p>is the reason for the NullPointerException, but as I said earlier, if the feed doesn't have the <code>&lt;enclosure&gt;</code> tag it works like it should.</p>
  
  <p>So to sum it up, if the XML file has an <code>&lt;enclosure&gt;</code> tag, it will cause the app to no longer work. But with out the tag, it works fine. What I am trying to do is to either ignore the tag or remove it (properly) and continue parsing the rest of the document.<br>
  At the moment nothing is working for me, which is why I am asking here.</p>
  
  <p>Any help would be greatly appreciated.</p>