Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] getting null value of node while retrieving from
 xml file

nageswara rao

2006-06-19

Replies:


Here is my code snippet:

public static void main(String args[]){
       try{
       DocumentBuilder
builder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
       File f=new File(args[0]);
       Document xmldoc=builder.parse(new InputSource(new
FileReader(f)));
       System.out.println("Document type is : "+xmldoc.getDoctype());
       NodeList recordslist=xmldoc.getElementsByTagName("FirstName");
       for(int i=0;i<recordslist.getLength();i++)
       {
       Node record=recordslist.item(i);

       System.out.println(" Record: "+i+" :\t"+record.getNodeValue());

       }
   }
   catch (Exception e)
   {
       e.printStackTrace();
   }
}


Thanks and Regards


G.Nageswara Rao
mobile: 09833763993
phone:022-55068473
mail : nageswara.rao@(protected)

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit us at http://www.polaris.co.in
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.