Java tutorial
//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)); } 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); } }