Here you can find the source of createDocument()
static Document createDocument() throws ParserConfigurationException
//package com.java2s; //License from project: GNU General Public License import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { static Document createDocument() throws ParserConfigurationException { final DocumentBuilder documentBuilder; documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return documentBuilder.newDocument(); }// ww w . j av a 2 s . co m }