Java tutorial
//package com.java2s; import java.util.LinkedHashMap; import java.util.Map; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Map<String, String> getTagValueMap(Element ele, String language) { Map<String, String> map = new LinkedHashMap<String, String>(); NodeList children = ele.getChildNodes(); Node current = null; int count = children.getLength(); for (int i = 0; i < count; i++) { current = children.item(i); if (current.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) current; map.put(current.getNodeName(), element.getFirstChild().getNodeValue()); } } return map; } }