Java XML Document from Stream load(InputStream data)

Here you can find the source of load(InputStream data)

Description

load

License

Open Source License

Declaration

public static Document load(InputStream data) throws SAXException,
        IOException 

Method Source Code

//package com.java2s;
/*// w  ww .  ja  v a  2s.co m
 * (c) Kitodo. Key to digital objects e. V. <contact@kitodo.org>
 *
 * This file is part of the Kitodo project.
 *
 * It is licensed under GNU General Public License version 3 or later.
 *
 * For the full copyright and license information, please read the
 * GPL3-License.txt file that was distributed with this source code.
 */

import java.io.IOException;
import java.io.InputStream;

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

import org.w3c.dom.Document;

import org.xml.sax.SAXException;

public class Main {

    public static Document load(InputStream data) throws SAXException,
            IOException {
        try {
            return DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder().parse(data);
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}

Related

  1. getXML(InputStream stream)
  2. getXML(InputStream stream)
  3. load(InputStream inputStream)
  4. load(InputStream stream)
  5. loadDocument(InputStream documentInputStream)
  6. loadDocument(InputStream documentInputStream)