Here you can find the source of parse(String xmlFile)
public static Document parse(String xmlFile) throws Exception
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.File; public class Main { public static Document parse(String xmlFile) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new File(xmlFile)); }//from w w w . j a va 2s. c o m public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { return newDocumentBuilderFactory().newDocumentBuilder(); } public static DocumentBuilderFactory newDocumentBuilderFactory() { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); return dbf; } }