Java tutorial
//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 { /** * 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); } } }