Here you can find the source of newDocument()
public static Document newDocument()
//package com.java2s; /*// ww w . ja v a 2 s.c o m * JFox - The most lightweight Java EE Application Server! * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn. * * JFox is licenced and re-distributable under GNU LGPL. */ import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { private final static DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); /** * new document */ public static Document newDocument() { try { return dbf.newDocumentBuilder().newDocument(); } catch (Exception e) { throw new RuntimeException(e); } } }