This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes null pointer exception 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 "null pointer exception" Watch "null pointer exception" New topic
Author

null pointer exception

sreeni kadiri
Greenhorn

Joined: Sep 16, 2004
Posts: 2
Hi ,

I am getting null pointer exception while calling parser.getDocument(). Before that I am calling parser.startDocument() using dom parser , what are the perameters do I need to pass.Help me out.

org.apache.xerces.parsers.DOMParser;

parser.startDocument(null,"UTF-8",null,null);
return parser.getDocument();// returing null value

please reply to srinikadiri@yahoo.com



thanks

Sreeni
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You're not supposed to call that method at all. Instead, call the parse() method.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
sreeni kadiri
Greenhorn

Joined: Sep 16, 2004
Posts: 2
Hi ,
I am trying to build a xml document , i don't have document to parse.Is there any alternative way to get document object.

Thanks
Sreeni
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by sreeni kadiri:
I am trying to build a xml document , i don't have document to parse.Is there any alternative way to get document object.

Ah. I'm not familiar with the DOMParser class myself since I never use it directly, but here's how you do it using the standard DOM API:
http://www.javaalmanac.com/egs/javax.xml.parsers/CreateDom.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: null pointer exception
 
Similar Threads
NULL Pointer Exception from the class while accessing from EJB/ HttpSession
SCJP Brainteaser (2)
Question on Boxing
Question on Exception
NULL Pointer Exception from the class which extends Hash Map. urgent help please