Here you can find the source of newDocument()
static public Document newDocument()
//package com.java2s; //License from project: Apache License import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Document; public class Main { static private DocumentBuilder parser = null; static public Document newDocument() { return parser.newDocument(); }/* ww w . j ava 2 s . co m*/ }