Here you can find the source of parse(String xml)
public static Document parse(String xml) throws Exception
//package com.java2s; //License from project: Mozilla Public License import java.io.StringReader; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.xml.sax.InputSource; public class Main { public static Document parse(String xml) throws Exception { return DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(new InputSource(new StringReader(xml))); }/*from w ww . jav a2s . co m*/ }