Here you can find the source of parseFile(File file)
public static Document parseFile(File file) throws org.xml.sax.SAXException, IOException, ParserConfigurationException
//package com.java2s; //License from project: GNU General Public 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; public class Main { public static Document parseFile(File file) throws org.xml.sax.SAXException, IOException, ParserConfigurationException { return newDocumentBuilder().parse(file); }/*w ww . ja v a 2s . com*/ private static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { // SAXParsers are not concurrency compatible, so always return a new instance to prevent thread issues DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); return dbf.newDocumentBuilder(); } }