在 xml 中有像 一样的空标签。
当我解析 xml 时,获得空指针异常。
我该如何在解析文件中检查标签?
ArrayList<String>textcomment = new ArrayList<String>();
for(int i = 0;i<nl.getLength();i++)
{
Element e = (Element)nl.item(i);
// crash on this string find first time a value and second time find </no_of_comments>
String noOfcomment = e.getElementsByTagName("no_of_comments").item(0).getFirstChild ().getNodeValue();
aryNoOfcomment.add(i, noOfcomment);
}