Techie Baba

Monday, April 07, 2008

How to convert Java String to DOM document Object?

It's a simple thing to do.
Just provide String Object as an InputSource or
InputStream to DocumentBuilder.

Example:
String xmlString;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();


DocumentBuilder builder = factory.newDocumentBuilder();


Document document =
builder.parse(
new InputSource(new StringReader(xmlString)));


This article has moved to my new BLOG.

Labels: , , , ,

8 Comments:

Post a Comment

<< Home