Java Utililty Methods XML Attribute Append

List of utility methods to do XML Attribute Append

  1. HOME
  2. Java
  3. X
  4. XML Attribute Append

Description

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

Method

void appendAllAttributes(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("='");
...
void appendAttribute(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);
void appendAttributeIfNotNull(Element parentElement, String attributeName, Object attributeValue)
append Attribute If Not Null
if (attributeValue != null) {
 parentElement.setAttribute(attributeName, attributeValue.toString());
void appendAttributeNode(String namespace, Element parent, String name, String value)
append Attribute Node
parent.setAttributeNS(namespace, name, value);
void appendAttributes(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());
...
void appendBooleanAttribute(Element thisElement, String attrName, boolean value)
append Boolean Attribute
appendStringAttribute(thisElement, attrName, String.valueOf(value));
void appendBooleanElement(Element parentElement, String nodeName, boolean value)
append Boolean Element
appendStringElement(parentElement, nodeName, String.valueOf(value));


AltStyle によって変換されたページ (->オリジナル) /