Here you can find the source of readXML(InputStream is)
Parameter | Description |
---|---|
is | a parameter |
Parameter | Description |
---|---|
ParserConfigurationException | an exception |
SAXException | an exception |
IOException | an exception |
public static Document readXML(InputStream is) throws ParserConfigurationException, SAXException, IOException
//package com.java2s; //License from project: LGPL import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class Main { /**/*from ww w. jav a 2 s . c om*/ * Read input stream into XML Document element * * @param is * @return * @throws ParserConfigurationException * @throws SAXException * @throws IOException */ public static Document readXML(InputStream is) throws ParserConfigurationException, SAXException, IOException { javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder(); org.w3c.dom.Document doc = db.parse(is); return doc; } /** * Read a XML text file to XML Document object * * @param xmlFile * @return * @throws ParserConfigurationException * @throws SAXException * @throws IOException */ public static Document readXML(String xmlFile) throws ParserConfigurationException, SAXException, IOException { javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder(); org.w3c.dom.Document doc = db.parse(xmlFile); return doc; } }