Here you can find the source of createDocument()
public static Document createDocument()
//package com.java2s; import org.w3c.dom.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; public class Main { public static Document createDocument() { try {//from w w w . ja va 2 s .co m DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = dbFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); return doc; } catch (Exception e) { throw new RuntimeException(e); } } }