Here you can find the source of loadDocument(String filePath)
public static Document loadDocument(String filePath) throws Exception
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; public class Main { public static Document loadDocument(String filePath) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(filePath); return doc; }// w ww . ja v a 2 s .c o m }