Java XML Document from Stream loadDocument(InputStream is)

Here you can find the source of loadDocument(InputStream is)

Description

load Document

License

Open Source License

Declaration

public static Document loadDocument(InputStream is)
            throws SAXException, IOException, ParserConfigurationException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010-2014, Zoltan Ujhelyi, Istvan Rath and Daniel Varro
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://from w  w w .ja v a 2s.  c om
 *   Zoltan Ujhelyi - initial API and implementation
 *******************************************************************************/

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 {
    private static final DocumentBuilderFactory FACTORY = DocumentBuilderFactory.newInstance();

    public static Document loadDocument(InputStream is)
            throws SAXException, IOException, ParserConfigurationException {
        return getDefaultFactory().newDocumentBuilder().parse(is);
    }

    public static DocumentBuilderFactory getDefaultFactory() {
        return FACTORY;
    }
}

Related

  1. load(InputStream stream)
  2. loadDocument(InputStream documentInputStream)
  3. loadDocument(InputStream documentInputStream)
  4. loadDocument(InputStream in)
  5. loadDocument(InputStream is)
  6. loadXmlDocumentFromStream(@Nonnull InputStream in)
  7. loadXMLFrom(final InputStream is)
  8. loadXmlFromInputSource(InputSource is)
  9. readXML(InputStream input)