Here you can find the source of mapNodeList(NodeList nodeList)
public static Map<Node, Map> mapNodeList(NodeList nodeList)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.*; public class Main { public static Map<Node, Map> mapNodeList(NodeList nodeList) { Map<Node, Map> map = new LinkedHashMap<>(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.hasChildNodes()) { map.put(node, mapNodeList(node.getChildNodes())); } else { map.put(node, Collections.emptyMap()); }/*w w w . j a va 2 s. c o m*/ } return map; } }