wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes Problem in reading xml file?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problem in reading xml file??" Watch "Problem in reading xml file??" New topic
Author

Problem in reading xml file??

Gaurav Jain
Ranch Hand

Joined: Mar 11, 2004
Posts: 108
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
 
subject: Problem in reading xml file??
 
Similar Threads
DocumentBuilder parse file is null
JSP and XML
Xml on netscape
Parsing a DOM object
writing updated data in to DOM memory