Android examples for XML:XML Attribute
get XML Attributes Map
//package com.java2s; import java.util.HashMap; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static HashMap<String, String> getAttributesMap(Element element) { NamedNodeMap attributes = element.getAttributes(); HashMap<String, String> map = new HashMap<String, String>( attributes.getLength()); for (int i = 0; i < attributes.getLength(); i++) { Node item = attributes.item(i); map.put(item.getNodeName(), item.getNodeValue()); }//from w w w . j a v a 2 s . com return map; } }