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

nageswara.rao at polaris.co.in nageswara.rao at polaris.co.in
Mon Jun 19 01:33:26 PDT 2006


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 at polaris.co.in

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


More information about the jdom-interest mailing list