Here you can find the source of getTagAttributes(Element element)
private static Map<String, String> getTagAttributes(Element element)
//package com.java2s; //License from project: LGPL import java.util.LinkedHashMap; import java.util.Map; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; public class Main { private static Map<String, String> getTagAttributes(Element element) { Map<String, String> attributes = new LinkedHashMap<String, String>(); NamedNodeMap sourceAttributes = element.getAttributes(); for (int i = 0; i < sourceAttributes.getLength(); ++i) { Attr attribute = (Attr) sourceAttributes.item(i); attributes.put(attribute.getName(), attribute.getValue()); }/*w w w . j av a 2s .c o m*/ return attributes; } }