Oct 01

Use a StringReader for your InputSource.


DocumentBuilderFactory factory = 
   DocumentBuilderFactory.newInstance();
InputSource source = new InputSource(
   new StringReader(xmlString))
Document document = 
   factory.newDocumentBuilder().parse(source); 

written by objects \\ tags: ,


2 Responses to “How do I create a DOM document from an XML String?”

  1. Shailendra Says:

    Exactly what I wanted this time!!
    Thanks!!

  2. Kleag Says:

    Very useful, indeed !

Leave a Reply

You must be logged in to post a comment.