Here you can find the source of parseDocument(String documentString)
@SuppressWarnings({ "ProhibitedExceptionDeclared" }) public static Document parseDocument(String documentString) throws Exception
//package com.java2s; /*// www . j a v a 2s . co m * SafeOnline project. * * Copyright 2006 Lin.k N.V. All rights reserved. * Lin.k N.V. proprietary/confidential. Use is subject to license terms. */ import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.Document; import org.xml.sax.InputSource; public class Main { @SuppressWarnings({ "ProhibitedExceptionDeclared" }) public static Document parseDocument(String documentString) throws Exception { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder domBuilder = domFactory.newDocumentBuilder(); StringReader stringReader = new StringReader(documentString); InputSource inputSource = new InputSource(stringReader); return domBuilder.parse(inputSource); } }