List of usage examples for org.w3c.dom Element setAttribute
public void setAttribute(String name, String value) throws DOMException;
From source file:Main.java
/** * Set an attribute and his value to the specified node *//*from www .j a v a 2s. com*/ public static void setAttributeValue(Element element, String attribute, String value) { element.setAttribute(attribute, value); }
From source file:Main.java
public static void writeStringAttr(Element element, String attributeName, String value) { element.setAttribute(attributeName, (value == null) ? "" : value); }
From source file:Main.java
public static void writeDoubleAttr(Element element, String attributeName, double value) { element.setAttribute(attributeName, Double.toString(value)); }
From source file:Main.java
public static void setLongAttribute(Element el, String attr, Long value) { if (null != value) { el.setAttribute(attr, value.toString()); }// ww w.java2s . com }
From source file:Main.java
public static void writeColorAttr(Element element, String attributeName, Color value) { element.setAttribute(attributeName, String.format("#%x", value.getRGB() & 0xffffff)); }
From source file:Main.java
public static void writeBoolAttr(Element element, String attributeName, boolean value) { element.setAttribute(attributeName, Boolean.toString(value)); }
From source file:Main.java
public static void setDoubleAttribute(Element node, String attr, double value) { try {/*from w w w . j a va 2s.c om*/ node.setAttribute(attr, doubleToString(value)); //node.setAttribute( attr, Double.toString( value ) ); } catch (NumberFormatException ex) { lastState = ERROR; } }
From source file:Main.java
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);/*from ww w . jav a2 s. c o m*/ Element parameter = outputDoc.createElement("parameters"); failure.appendChild(parameter); // Element output = outputDoc.createElement("output"); // failure.appendChild(output); return failure; }
From source file:Main.java
/** * Create a success element, and append the correct command name. * //from ww w. java2s . c o m * @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; }
From source file:Main.java
public static void setDoubleAttribute(Element el, String attr, Double value) { if (null != value) { el.setAttribute(attr, value.toString()); }/* w w w .j a v a 2 s . c om*/ }