File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes while parsing Inputsource returns document gets NULL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "while parsing Inputsource returns document gets NULL" Watch "while parsing Inputsource returns document gets NULL" New topic
Author

while parsing Inputsource returns document gets NULL

Anand Loganathan
Greenhorn

Joined: Sep 13, 2003
Posts: 12
I am getting response XML as string from JAX-RPC. I need to parse this document and read it by using DOM. This is my following code.

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource in = new InputSource(new StringReader(xml));
//new StringReader(xml);
Document dom = builder.parse(in);

Here, in this case while builder.parse returns null value. Any idea where I am making mistake.

your help is highly appreciated.
Anand Loganathan
Greenhorn

Joined: Sep 13, 2003
Posts: 12
The problem got resolved. I was making mistake while reading the document.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: while parsing Inputsource returns document gets NULL