Here you can find the source of parseXml(File file)
public static Document parseXml(File file) throws Exception
//package com.java2s; // This software is released under the Apache License 2.0. import org.w3c.dom.*; import javax.xml.parsers.*; import java.io.*; public class Main { public static Document parseXml(File file) throws Exception { return newDocumentBuilder().parse(file); }/*from ww w .j av a2 s .c om*/ public static Document parseXml(String xml) throws Exception { return newDocumentBuilder().parse(new ByteArrayInputStream(xml.getBytes("UTF-8"))); } private static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(false); return domFactory.newDocumentBuilder(); } }