Wednesday, April 25, 2012

Dom parsing in android

i have parsed xml using dom parser,but when the xml element contains no value it throws null pointer Exception.how to check this?...
here my code



NodeList TrackName1 = fstElmnt2.getElementsByTagName("Artist_Name");    


Element TrackElement1 = (Element) TrackName1.item(0);

TrackName1 = TrackElement1.getChildNodes();
result=result+((Node) TrackName1.item(0)).getNodeValue()

String Artistname=((Node)TrackName1.item(0)).getNodeValue();



}




No comments:

Post a Comment