Here you can find the source of newDocument()
public static Document newDocument()
//package com.java2s; //License from project: Apache License import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { /**//from www .j a va2 s. c o m * Document builder factory */ private static DocumentBuilderFactory factory = null; /** * Creates a new Document using the default XML implementation * * @return DOM */ public static Document newDocument() { try { return factory.newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException(e.getMessage(), e); } } }