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: ,


One Response to “How do I create a DOM document from an XML String?”

  1. Shailendra Says:

    Exactly what I wanted this time!!
    Thanks!!

Leave a Reply