Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; import org.w3c.dom.Element; public class Main { public static Map<String, String> getAttributes(Element e) { Map results = new HashMap(); for (int i = 0; i < e.getAttributes().getLength(); i++) { results.put(e.getAttributes().item(i).getNodeName(), e.getAttributes().item(i).getNodeValue()); } return results; } }