Here you can find the source of loadDocument(InputStream documentInputStream)
public static Document loadDocument(InputStream documentInputStream) throws ParserConfigurationException, SAXException, IOException
//package com.java2s; /*//from w w w .j ava 2 s. c om * 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.SAXException; public class Main { public static Document loadDocument(InputStream documentInputStream) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder; documentBuilder = documentBuilderFactory.newDocumentBuilder(); return documentBuilder.parse(documentInputStream); } }