Java XML Parse File parse(File file)

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

Description

parse

License

Open Source License

Declaration

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

Method Source Code


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

import java.io.File;

import java.io.IOException;

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

import org.w3c.dom.Document;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class Main {
    public static Document parse(File file) throws SAXException, IOException, ParserConfigurationException {
        return getDocumentBuilder().parse(file);
    }/* w  ww.  j  a  v  a2 s  . c o m*/

    public static Document parse(InputSource source)
            throws ParserConfigurationException, SAXException, IOException {
        return getDocumentBuilder().parse(source);
    }

    public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException {
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        dbFactory.setNamespaceAware(true);
        return dbFactory.newDocumentBuilder();
    }
}

Related

  1. parse(File f, DefaultHandler dh)
  2. parse(File file)
  3. parse(File file)
  4. parse(File file)
  5. parse(File file)
  6. parse(File file)
  7. parse(File file)
  8. parse(File iFile)
  9. parse(File input)