Here you can find the source of loadDocument(InputStream documentInputStream)
Parameter | Description |
---|---|
SAXException | an exception |
IOException | an exception |
public static Document loadDocument(InputStream documentInputStream) throws SAXException, IOException
//package com.java2s; /*//from w ww . j a va 2 s . c om * SafeOnline project. * * Copyright 2006-2007 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.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class Main { /** * Loads a DOM document from the given input stream. * * @throws SAXException * @throws IOException */ public static Document loadDocument(InputStream documentInputStream) throws SAXException, IOException { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); return documentBuilderFactory.newDocumentBuilder().parse(documentInputStream); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } } }