Here you can find the source of getNewDocument()
public static Document getNewDocument()
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 Dipanjan Das // w w w . j a v a 2 s. c o m * Language Technologies Institute, * Carnegie Mellon University, * All Rights Reserved. * * XmlUtils.java is part of SEMAFOR 2.0. * * SEMAFOR 2.0 is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SEMAFOR 2.0 is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with SEMAFOR 2.0. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ import org.w3c.dom.Document; public class Main { public static Document getNewDocument() { Document doc = null; //initializing the DOM object to load the XML object into try { javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory .newInstance(); javax.xml.parsers.DocumentBuilder docbuilder = factory .newDocumentBuilder(); doc = docbuilder.newDocument(); } catch (Exception e) { e.printStackTrace(); } return doc; } }