Java tutorial
//package com.java2s; /** * This file belongs to the BPELUnit utility and Eclipse plugin set. See enclosed * license file for more information. */ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { public static Document createDocument() { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); DocumentBuilder dBuilder; try { dBuilder = dbFactory.newDocumentBuilder(); return dBuilder.newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException("Could not create XML document", e); } } }