Java tutorial
//package com.java2s; import java.util.HashMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { private static HashMap<String, String> getValoresNodo(Node nodo) { HashMap<String, String> valores = new HashMap<String, String>(); NodeList listaNodo = nodo.getChildNodes(); for (int i = 0; i < listaNodo.getLength(); i++) { Node n = listaNodo.item(i); valores.put(n.getNodeName(), getValorNodo(n)); } return valores; } private static String getValorNodo(Node nodo) { return nodo.getChildNodes().item(0).getNodeValue(); } }