Document document = parser.getDocument();
Element RootElement = document.getDocumentElement();
NodeList Children = RootElement.getChildNodes();
NodeList ndeList = Children;
NodeList ndeMenuList;
NodeList ndeMenuItemList;
for(int i=0; i<ndeList.getLength();i++) {
if ( ndeList.item(i).getNodeType() == Node.ELEMENT_NODE ) {
String text = "";
//if ( ndeList.item(i).getNodeType() == Node.TEXT_NODE )
System.out.println(ndeList.item(i).getNodeName() + " = " + ndeList.item(i).getFirstChild().getNodeValue());
if ( ndeList.item(i).hasChildNodes() ) {
ndeMenuList = ndeList.item(i).getChildNodes();
for( int j=0; j < ndeMenuList.getLength(); j++ ) {
if ( ndeMenuList.item(j).getNodeType() == Node.ELEMENT_NODE ) {
System.out.println("\t" + ndeMenuList.item(j).getNodeName() + " = " + ndeMenuList.item(j).getFirstChild().getNodeValue() );
if ( ndeMenuList.item(j).getNodeType() == Node.ELEMENT_NODE ) {
ndeMenuItemList = ndeMenuList.item(j).getChildNodes();
for(int k=0; k<ndeMenuItemList.getLength();k++) {
System.out.println("\t\t" + ndeMenuItemList.item(k).getNodeName() + " = " + ndeMenuItemList.item(k).getNodeValue() );
}
}
}
}
}
}
}
I have this code and every time I do getNodeValue it returns null value when it prints
the examples say use getFirstChild() but it doesnt have a childNode