Here you can find the source of stringToDom(String xmlSource)
public static Document stringToDom(String xmlSource) throws SAXException, ParserConfigurationException, IOException
//package com.java2s; //License from project: Apache License import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; public class Main { public static Document stringToDom(String xmlSource) throws SAXException, ParserConfigurationException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance();/* w ww. j a v a2 s. c o m*/ DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new InputSource(new StringReader(xmlSource))); } }