Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Map<String, String> getChildElements(Node parent) { Map<String, String> elements = new HashMap<String, String>(); NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); elements.put(child.getNodeName(), child.getTextContent()); } return elements; } }