Here you can find the source of newDocument(File file)
public static Document newDocument(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { public static Document newDocument(File file) { try {// w w w. j a v a2s . c om return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file); } catch (Exception e) { throw new IllegalStateException("Error parsing project set file: ".concat(file.getAbsolutePath()), e); } } }