Java XML NodeList mapNodeList(NodeList nodeList)

Here you can find the source of mapNodeList(NodeList nodeList)

Description

map Node List

License

Open Source License

Declaration

public static Map<Node, Map> mapNodeList(NodeList nodeList) 

Method Source Code

//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;
    }
}

Related

  1. iterable(NodeList nodeList)
  2. iterableNodes(final NodeList nodeList)
  3. iterableNodes(final NodeList nodeList)
  4. listOf(final NodeList nodeList)
  5. listOf(final NodeList nodeList)
  6. mergeTextContent(final NodeList nodes)
  7. mergeTextContent(NodeList nodes)
  8. parserXml(NodeList employees, Class class_type)
  9. parseSwitcherConfigs(NodeList switcherConfigNodes)