Here you can find the source of appendAttributes(Node node, StringBuffer sb)
private static void appendAttributes(Node node, StringBuffer sb)
//package com.java2s; /*/* w w w .ja va2 s . c o m*/ * www.openamf.org * * Distributable under LGPL license. * See terms of license at gnu.org. */ import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { private static void appendAttributes(Node node, StringBuffer sb) { 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()); sb.append('"'); } } } }