The list of methods to do XML Attribute Append are organized into topic(s).
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
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());
...