Java XML Document Parse parseDocument(File f)

Here you can find the source of parseDocument(File f)

Description

parse Document

License

Open Source License

Declaration

public static Document parseDocument(File f) throws SAXException, IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileInputStream;

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

import javax.xml.parsers.DocumentBuilder;

import org.w3c.dom.Document;

import org.xml.sax.SAXException;

public class Main {
    private static DocumentBuilder builder;

    public static Document parseDocument(File f) throws SAXException, IOException {
        InputStream stream = new FileInputStream(f);
        Document doc = builder.parse(stream);
        stream.close();//  www  . j  av  a 2s.c om
        return doc;
    }
}

Related

  1. parse(final DocumentBuilder documentBuilder, final File pomFile)
  2. parse(String document)
  3. parseDocument(byte[] bytes)
  4. parseDocument(File file)
  5. parseDocument(InputSource is)
  6. parseDocument(InputStream documentXml)
  7. parseDocument(InputStream in)