Java tutorial
//package com.java2s; //License from project: Open Source License import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { /** * Cria um documento XML vazio * @return Document -> novo documento XML * @throws Exception */ public static Document criarDocumentoXMl() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db; db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); return doc; } }