Java examples for XML:DOM Document
Create some Document
//package com.java2s; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; public class Main { public static Document someDocument() { try {//from w ww.ja v a 2s . c om DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setNamespaceAware(true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.newDocument(); } catch (Exception e) { throw new RuntimeException(e); } } }