I am parsing a xmlfile on android and I have something similar to:
<images>
<image></image>
</images>
I have the following code:
Element imagesElement = (Element) poiElement.getElementsByTagName("images").item(0);
NodeList images = imagesElement.getElementsByTagName("image");
for (int n = 0; n < images.getLength(); n++) {
Element imgElement = (Element) images.item(n);
String imgUrl = getTagValue("image", imgElement);<< ERROR HERE
if (imgUrl != "") {
//do something here }
}
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!
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?
Bex