Java tutorial
//package com.java2s; import java.util.LinkedHashMap; import java.util.Map; import org.w3c.dom.NamedNodeMap; public class Main { private static Map attrbiuteToMap(NamedNodeMap attributes) { if (attributes == null) return new LinkedHashMap(); Map result = new LinkedHashMap(); for (int i = 0; i < attributes.getLength(); i++) { result.put(attributes.item(i).getNodeName(), attributes.item(i).getNodeValue()); } return result; } }