Here you can find the source of createDocument()
public static Document createDocument() throws ParserConfigurationException
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { public static Document createDocument() throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance() .newDocumentBuilder();//from ww w .ja va 2s .c o m return builder.newDocument(); } }