getting null value of node while retrieving from xml file 2006-06-19 - By nageswara.rao@(protected)
Back
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)
|
|