Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in reading xml file??

 
Gaurav Jain
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to read a xml file and convert in to a DOM object.
Following is the code:
DocumentBuilder objBuilder = objFactory.newDocumentBuilder();
File f = new File("P:/My Documents/IBM/wsappdev51/workspace/MyXML/xmlproperties/NewFile.xml");
objDOM = objBuilder.parse(f);

I am getting the DOM object as null.
I guess its not able to find the xml file although when i print "f" it gives me the correct path of the file.
What is the problem??
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never heard of the DocumentBuilder#parse(...) method returning a null (I believe the JAXP specification states that a compliant parser implementation should always either return an org.w3c.dom.Document object or throw an exception). Which parser implementation are you using?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic