Here you can find the source of getDocument()
public static Document getDocument()
//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 getDocument() { Document document = null; DocumentBuilder db;/*from ww w. j a v a 2 s . com*/ try { db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); document = db.parse("src/exam.xml"); } catch (Exception e) { e.printStackTrace(); } return document; } }