Java XML Document from Stream loadXmlFromInputSource(InputSource is)

Here you can find the source of loadXmlFromInputSource(InputSource is)

Description

load Xml From Input Source

License

Apache License

Declaration

private static Document loadXmlFromInputSource(InputSource is) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class Main {
    private static Document loadXmlFromInputSource(InputSource is) {
        try {//w  w w  . j  av a 2 s.c  o  m
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            return db.parse(is);
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e);
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. loadDocument(InputStream in)
  2. loadDocument(InputStream is)
  3. loadDocument(InputStream is)
  4. loadXmlDocumentFromStream(@Nonnull InputStream in)
  5. loadXMLFrom(final InputStream is)
  6. readXML(InputStream input)
  7. readXml(InputStream inputStream)
  8. readXML(InputStream inputStream, EntityResolver resolver, ErrorHandler error)
  9. readXML(InputStream inStream)