Here you can find the source of createDocument(InputSource is)
public static Document createDocument(InputSource is) throws Exception
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.*; import org.xml.sax.InputSource; public class Main { public static Document createDocument(InputSource is) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setIgnoringElementContentWhitespace(true); factory.setCoalescing(true);/*from ww w .java 2s . c om*/ DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(is); } }