Java XML DOM from File fileToDOM(File file)

Here you can find the source of fileToDOM(File file)

Description

file To DOM

License

Open Source License

Declaration

public static Document fileToDOM(File file) throws ParserConfigurationException, IOException, SAXException 

Method Source Code


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

import org.w3c.dom.Document;

import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import java.io.*;

public class Main {
    public static Document fileToDOM(File file) throws ParserConfigurationException, IOException, SAXException {
        DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
        return docBuilder.parse(file);

    }/*from   w  w w. j a v a 2 s .  co m*/
}

Related

  1. file2Dom(File file)
  2. fileToDom(String fileName)