Here you can find the source of parse(File file)
public static Document parse(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { public static Document parse(File file) { Document configDoc = null; try {/* w ww.jav a 2s. com*/ File fXmlFile = file; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); configDoc = dBuilder.parse(fXmlFile); configDoc.getDocumentElement().normalize(); } catch (Exception e) { e.printStackTrace(); } return configDoc; } }