Here you can find the source of parse(String input)
public static Document parse(String input) throws SAXException, ParserConfigurationException
//package com.java2s; // This file is part of nzdis-util package. See the file LICENSE for copyright information import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.io.StringReader; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class Main { public static Document parse(InputStream input, Properties props) throws SAXException, ParserConfigurationException { return parse(new InputSource(input), props); }//from ww w . j ava 2 s . com public static Document parse(String input) throws SAXException, ParserConfigurationException { return parse(new StringReader(input), null); } public static Document parse(Reader input) throws SAXException, ParserConfigurationException { return parse(new InputSource(input), null); } public static Document parse(Reader input, Properties props) throws SAXException, ParserConfigurationException { return parse(new InputSource(input), props); } public static Document parse(InputSource input, @SuppressWarnings("unused") Properties props) throws SAXException, ParserConfigurationException { Document doc = null; try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); doc = docBuilder.parse(input); } catch (IOException e) { e.printStackTrace(System.out); //throw e; } return doc; } }