Here you can find the source of createDocument()
public static Document createDocument()
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { /**/* w ww . j av a 2 s .c o m*/ * Returns a new, empty DOM document. * * @return Returns a new DOM document. */ public static Document createDocument() { Document result = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder parser = factory.newDocumentBuilder(); result = parser.newDocument(); } catch (Exception e) { System.out.println(e.getMessage()); } return result; } }