Java XML Parse Stream parse(InputStream inputStream)

Here you can find the source of parse(InputStream inputStream)

Description

parse

License

Open Source License

Declaration

public static Document parse(InputStream inputStream) throws IOException, SAXException 

Method Source Code


//package com.java2s;
/*//from  w w  w.  j  av a  2  s .  co m
 * Copyright (C) 2018 Saxon State and University Library Dresden (SLUB)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;

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

public class Main {
    @SuppressWarnings("CanBeFinal") // initialization happens in static block
    private static DocumentBuilder db;

    public static Document parse(InputStream inputStream) throws IOException, SAXException {
        Document doc = db.parse(inputStream);
        doc.getDocumentElement().normalize();
        return doc;
    }
}

Related

  1. parse(InputStream anInputStream)
  2. parse(InputStream byteStream)
  3. parse(InputStream in)
  4. parse(InputStream in)
  5. parse(InputStream inputStream)
  6. parse(InputStream is)
  7. parse(InputStream is)
  8. parse(InputStream is)
  9. parse(InputStream is)