Here you can find the source of load(String file)
public static Document load(String file)
//package com.java2s; //License from project: Apache License import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import java.io.File; public class Main { public static Document load(String file) { try {// w ww .ja va2s.c o m Document document = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setNamespaceAware(false); DocumentBuilder builder = dbf.newDocumentBuilder(); document = builder.parse(new File(file)); document.normalize(); return document; } catch (Exception e) { e.printStackTrace(); } return null; } }