List of usage examples for org.w3c.dom Element setAttribute
public void setAttribute(String name, String value) throws DOMException;
From source file:Main.java
/** * This method creates an attribute with the given name and value. * * @param sName The name of the attribute. * @param sValue The value of the atrtibute. * @param nParent The parent node./*from w w w. j a v a 2 s . com*/ */ public static void createAttribute(String sName, String sValue, Node nParent) { if ((nParent != null) && (nParent instanceof Element)) { Element eParent = (Element) nParent; eParent.setAttribute(sName, sValue); } }
From source file:Main.java
public static Node addAttribute(Document doc, org.w3c.dom.Element e, String index, String value) { e.setAttribute(index, value); return e;/*from ww w. j a va 2 s . c o m*/ }
From source file:Main.java
public static void addParameter(Document outDoc, Element succFail, String name, String value) { //System.out.println("value:" + value); Element parameters = (Element) succFail.getElementsByTagName("parameters").item(0); Element parameter = outDoc.createElement(name); parameter.setAttribute("value", value); parameters.appendChild(parameter);/* w w w .j av a 2 s .c o m*/ }
From source file:Main.java
/** * Method setIntegerAttribute/*from ww w . j a v a2 s . c om*/ * * @param element * @param attributeName * @param value */ public static void setIntegerAttribute(Element element, String attributeName, int value) { element.setAttribute(attributeName, Integer.toString(value)); }
From source file:Main.java
/** * Method setDoubleAttribute//from w ww . j ava2 s . co m * * @param element * @param attributeName * @param value */ public static void setDoubleAttribute(Element element, String attributeName, double value) { element.setAttribute(attributeName, Double.toString(value)); }
From source file:Main.java
/** * Append a <code>fatalError</code> tag to the result xml document. * //from w w w. j av a 2 s . com * @param output * the output w3c XML Document object */ public static void fatalError(Document output, String note) { Element fatalError = output.createElement("fatalError"); fatalError.setAttribute("note", note); output.appendChild(fatalError); }
From source file:Main.java
public static void setAllIdentityAttribute(Document document, String attributeValue) { NodeList propertyList = document.getElementsByTagName("Property"); for (int i = 0; i < propertyList.getLength(); i++) { Node node = propertyList.item(i); for (int j = 0; j < node.getAttributes().getLength(); j++) { Node attribute = node.getAttributes().item(j); if (attribute.getNodeName().equals("name") && attribute.getNodeValue().equals(attributeValue)) { Element element = (Element) node; element.setAttribute("isIdentity", "true"); }/*from w ww . ja va2s . c o m*/ } } }
From source file:Main.java
public static void setIdAttr(Element element, String Id) { element.setAttribute("Id", Id); element.setIdAttribute("Id", true); }
From source file:Main.java
public static Node createNode(Document document, String nodeName, String nodeValue) throws Exception { Element nodeElement = document.createElement("Property"); nodeElement.setAttribute("name", nodeName); Element nodeValueElement = document.createElement("Value"); nodeValueElement.setTextContent(nodeValue); nodeElement.appendChild(nodeValueElement); return nodeElement; }
From source file:Main.java
public static void writeIntAttr(Element element, String attributeName, int value) { element.setAttribute(attributeName, Integer.toString(value)); }