getting a null pointer exception
Hi, I am trying to parse a very simple xml file but getting a null pointer exception while reading the text node, for some reason I am getting a null value while reading the text node of an element node, below is the xml and the code snippet ..any help is greatly appreciated..
<?xml version="1.0" encoding="UTF-8"?>
<list>
<fitem localPath="c:\projects\install.log" />
</list>
code snippet
NodeList nodeLst = doc.getElementsByTagName("fitem");
for (int s = 0; s < nodeLst.getLength(); s++) {
Node fstNode = nodeLst.item(s);
if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
Element fstElmnt = (Element) nodeLst.item(0);
NodeList fileItm = fstElmnt.getChildNodes();
System.out.println("FileItem : " + ((Node) fileItm.item(0)).getNodeValue());
}