List of usage examples for org.w3c.dom Element setAttribute
public void setAttribute(String name, String value) throws DOMException;
From source file:Main.java
public static void setURIAttribute(Element el, String attr, URI uri) { el.setAttribute(attr, uri.toString()); }
From source file:Main.java
private static void makeChanges(Document document) { Element root = document.getDocumentElement(); root.setAttribute("test", "testvalue"); }
From source file:Main.java
public static void setTextAttribute(Element el, String attr, String value) { el.setAttribute(attr, value); }
From source file:Main.java
public static void addAttribute(Document doc) { Element root = doc.getDocumentElement(); Element person = (Element) root.getFirstChild(); person.setAttribute("company", "yourCom"); }
From source file:Main.java
public static void setBooleanAttribute(Element el, String attr, boolean value) { el.setAttribute(attr, Boolean.toString(value)); }
From source file:Main.java
/** * Sets the content of an attribute in the specified node. * If the attribute already exists, its content is modified with the text * specified in <b>value</b>. If the attribute doesn't exist, a new one * (with the name specified in <b>name</b>) is created. * @param node The node that will contain the specified attribute. * @param name The name of the attribute to set the text. * @param value The text to place in the specified attribute. *///from w w w .j av a 2 s . c o m public static void SetNodeAttribute(Node node, String name, String value) { Element x = (Element) node; x.setAttribute(name, value); }
From source file:Main.java
public static void setElementAttr(Element element, String attr, String attrVal) { element.setAttribute(attr, attrVal); }
From source file:Utils.java
/** * Set an Attribute in an Element//from w w w . j av a 2 s . co m * @param element the containing Element * @param name the attribute name * @param value the attribute value */ public static void setAttribute(Element element, String name, String value) { element.setAttribute(name, value); }
From source file:Main.java
public static Document appendChildWithAttribute(Document doc, String nodeName, String parentNodeName, String attrName, String attrValue) { Element node = doc.createElement(nodeName); node.setAttribute(attrName, attrValue); doc.getElementsByTagName(parentNodeName).item(0).appendChild(node); return doc;/*from w ww . j ava2 s . com*/ }
From source file:Main.java
public static Element createRoot(Document document, String title) { Element node = document.createElement(title); node.setAttribute("xmlns", "http://www.supermap.com.cn/desktop"); node.setAttribute("version", "9.0.x"); document.appendChild(node);/*from w w w . j a v a 2s . c om*/ return node; }