Java tutorial
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static Element createFailure(Document outputDoc, String commandName, String type) { Element failure = outputDoc.createElement("failure"); failure.setAttribute("type", type); Element cmd = outputDoc.createElement("command"); cmd.setAttribute("name", commandName); failure.appendChild(cmd); Element parameter = outputDoc.createElement("parameters"); failure.appendChild(parameter); // Element output = outputDoc.createElement("output"); // failure.appendChild(output); return failure; } }