Java tutorial
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { /** * Create a success element, and append the correct command name. * * @param outDoc * the document for output xml * @param commandName * name of the successfully executed command * @return a <success><commmand name=$commandname /></success> Element */ public static Element createSuccess(Document outDoc, String commandName) { Element success = outDoc.createElement("success"); Element cmd = outDoc.createElement("command"); cmd.setAttribute("name", commandName); success.appendChild(cmd); Element parameter = outDoc.createElement("parameters"); success.appendChild(parameter); Element output = outDoc.createElement("output"); success.appendChild(output); return success; } }