why does getTagValue throws nullpointer if empty
<p>I am parsing a xmlfile on android and I have something similar to:</p>

<pre><code>&lt;images&gt;
 &lt;image&gt;&lt;/image&gt;
&lt;/images&gt;
</code></pre>

<p>I have the following code:</p>

<pre><code>Element imagesElement = (Element) poiElement.getElementsByTagName("images").item(0);
                        NodeList images = imagesElement.getElementsByTagName("image");
                        for (int n = 0; n &lt; images.getLength(); n++) {
                            Element imgElement = (Element) images.item(n);
                            String imgUrl = getTagValue("image", imgElement);&lt;&lt; ERROR HERE
                            if (imgUrl != "") {
                                //do something here                             }
                        }
</code></pre>

<p>If I run the getTagValue("image",imgElement) when the tag is empty I get a null pointer exception, if I run it when there is something in it it returns the value. I'd expect an empty string if it was empty!</p>

<p>I've tried examining the imgElement in eclipses debugger to try and determine how I check if it's empty but I can't work out how! Can anyone help?</p>

<p>Bex</p>
