devxlogo

Traverse All the Nodes of a DOM Tree

Traverse All the Nodes of a DOM Tree

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

devx-admin

Share the Post: