Java XML Document Create getDocument(File file)

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

Description

get Document

License

Open Source License

Declaration

public static org.w3c.dom.Document getDocument(File file)
        throws SAXException, IOException, ParserConfigurationException 

Method Source Code


//package com.java2s;
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.xml.sax.SAXException;

public class Main {

    public static org.w3c.dom.Document getDocument(String xmlPath)
            throws SAXException, IOException, ParserConfigurationException {
        return getDocument(new File(xmlPath));
    }/*w ww.ja va2 s  .  co m*/

    public static org.w3c.dom.Document getDocument(File file)
            throws SAXException, IOException, ParserConfigurationException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        return builder.parse(file);
    }
}

Related

  1. getDocument(Document document)
  2. getDocument(DOMSource source)
  3. getDocument(File f)
  4. getDocument(File file)
  5. getDocument(File file)
  6. getDocument(File file)
  7. getDocument(File file)
  8. getDocument(final File file)
  9. getDocument(InputStream in)