Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2009, 2013 Andrew Gvozdev (Quoin Inc.). * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Andrew Gvozdev (Quoin Inc.) *******************************************************************************/ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { /** * Convenience method to create new XML DOM Document. * * @return a new instance of a DOM {@link Document}. * @throws ParserConfigurationException in case of a problem retrieving {@link DocumentBuilder}. */ public static Document newDocument() throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.newDocument(); } }