Java tutorial
//package com.java2s; import org.w3c.dom.*; import javax.xml.parsers.*; import java.io.*; public class Main { /** * Create a new DOM document */ public static Document newDocument() throws IOException { try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); return builder.newDocument(); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } } }