Java XML Document from File getXML(File xmlFile)

Here you can find the source of getXML(File xmlFile)

Description

get XML

License

Open Source License

Declaration

public static Document getXML(File xmlFile) throws ParserConfigurationException, IOException, SAXException 

Method Source Code


//package com.java2s;

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 getXML(File xmlFile) throws ParserConfigurationException, IOException, SAXException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.parse(xmlFile);
        document.getDocumentElement().normalize();
        return document;
    }//  www . java2s .  c om
}

Related

  1. getDocumentFromFile(File file)
  2. getDocumentFromFile(String absolutePath)
  3. getXML(File file)
  4. getXmlDocument(File file)
  5. getXmlDocument(File file)
  6. getXmlDocument(String fileName)
  7. isXMLFile(File file)