Here you can find the source of parseXmlFile(String xmlFile)
public static Document parseXmlFile(String xmlFile) throws Exception
//package com.java2s; //License from project: Apache License import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { public static Document parseXmlFile(String xmlFile) throws Exception { //get the factory DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); //Using factory get an instance of document builder DocumentBuilder db = dbf.newDocumentBuilder(); //parse using builder to get DOM representation of the XML file Document dom = db.parse(xmlFile); return dom; }/* ww w . jav a 2s . co m*/ }