Java Utililty Methods XML Attribute Append

List of utility methods to do XML Attribute Append

Description

The list of methods to do XML Attribute Append are organized into topic(s).

Method

voidappendAllAttributes(Node node, StringBuffer xpath)
append All Attributes
NamedNodeMap attr = node.getAttributes();
int len = attr.getLength();
if (len > 0) {
    for (int i = 0; i < len; i++) {
        Node item = attr.item(i);
        xpath.append("[@");
        xpath.append(item.getNodeName());
        xpath.append("='");
...
voidappendAttribute(Node node, String name, String value)
Append the specified key/value pair of attributes to the Node.
Node attribute = node.getOwnerDocument().createAttribute(name);
attribute.setNodeValue(value);
node.getAttributes().setNamedItem(attribute);
voidappendAttributeIfNotNull(Element parentElement, String attributeName, Object attributeValue)
append Attribute If Not Null
if (attributeValue != null) {
    parentElement.setAttribute(attributeName, attributeValue.toString());
voidappendAttributeNode(String namespace, Element parent, String name, String value)
append Attribute Node
parent.setAttributeNS(namespace, name, value);
voidappendAttributes(Node node, StringBuffer sb)
append Attributes
if (node instanceof Element) {
    NamedNodeMap nodeMap = node.getAttributes();
    for (int i = 0; i < nodeMap.getLength(); i++) {
        sb.append(' ');
        sb.append(nodeMap.item(i).getNodeName());
        sb.append('=');
        sb.append('"');
        sb.append(nodeMap.item(i).getNodeValue());
...
voidappendBooleanAttribute(Element thisElement, String attrName, boolean value)
append Boolean Attribute
appendStringAttribute(thisElement, attrName, String.valueOf(value));
voidappendBooleanElement(Element parentElement, String nodeName, boolean value)
append Boolean Element
appendStringElement(parentElement, nodeName, String.valueOf(value));