Here you can find the source of getAttributes(Node node)
public static Map<String, String> getAttributes(Node node)
//package com.java2s; //License from project: LGPL import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import java.util.*; public class Main { public static Map<String, String> getAttributes(Node node) { NamedNodeMap attributeMap = node.getAttributes(); HashMap<String, String> attributes = new HashMap<String, String>(attributeMap.getLength()); for (int i = 0; i < attributeMap.getLength(); i++) { Node attr = attributeMap.item(i); if (attr instanceof Attr) { attributes.put(((Attr) attr).getName(), ((Attr) attr).getValue()); }/* w w w .j a v a 2 s. c o m*/ } return attributes; } }