This is just a litle method that illustrates how to get the minimum of information from all nodes of a DOM tree. The key of this method is the "old-school" recursive style:
private void traverseAllNodes(Node node)
{
if(node.hasChildNodes())
{
NodeList NL=node.getChildNodes();
for(int i=0;i<NL.getLength();i++)
{
Node childnode=NL.item(i);
System.out.print("Name:"+childnode.getNodeName());
System.out.print("Value:"+childnode.getNodeValue()+"\n");
viewAllNodes(childnode);
}
}
}