View Single Post
  #2 (permalink)  
Old 11-02-2007, 10:44 AM
murali_java murali_java is offline
Member
 
Join Date: Nov 2007
Location: BANGALORE,INDIA
Posts: 3
murali_java is on a distinguished road
try the following code:

Code:
Document doc = db.parse (new File("c:\\exp\\item.xml")); NodeList nl =doc.getElementsByTagName("category"); System.out.println(" no of nodes for root = "+ nl.getLength()); for(int i =0 ;i<nl.getLength();i++){ Node n = nl.item(i); System.out.print(n.getNodeName()); NodeList nll=n.getChildNodes(); for(int ii =0 ;ii<nll.getLength();ii++){ Node nn = nll.item(ii); System.out.println("==>"+nn.getNodeValue()); } }
others please optimise the code.

Last edited by JavaBean : 11-02-2007 at 11:33 AM.
Reply With Quote