Java tutorial
//package com.java2s; import javax.xml.parsers.*; import org.w3c.dom.*; public class Main { static public Document newDocument() { Document document = null; DocumentBuilder builder = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { builder = factory.newDocumentBuilder(); document = builder.newDocument(); } catch (ParserConfigurationException e) { e.printStackTrace(); } return document; } }