Here you can find the source of parseSwitchers(NodeList switcherNodes)
private static Map<String, Map<String, String>> parseSwitchers(NodeList switcherNodes)
//package com.java2s; //License from project: Apache License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.HashMap; import java.util.Map; public class Main { private static Map<String, Map<String, String>> parseSwitchers(NodeList switcherNodes) { Map<String, Map<String, String>> switchers = new HashMap<>(); for (int i = 0; i < switcherNodes.getLength(); ++i) { Node switcherNode = switcherNodes.item(i); NamedNodeMap switcherAttributes = switcherNode.getAttributes(); if (switcherAttributes != null) { String switcherClassName = switcherAttributes.getNamedItem("class").getTextContent(); Map<String, String> configs = parseSwitcherConfigs(switcherNode.getChildNodes()); switchers.put(switcherClassName, configs); }/*from w w w . ja va 2 s.c o m*/ } return switchers; } private static Map<String, String> parseSwitcherConfigs(NodeList switcherConfigNodes) { Map<String, String> configs = new HashMap<>(); for (int i = 0; i < switcherConfigNodes.getLength(); ++i) { NamedNodeMap attributes = switcherConfigNodes.item(i).getAttributes(); if (attributes != null) { String[] keyValue = parseConfigAttr(attributes); configs.put(keyValue[0], keyValue[1]); } } return configs; } private static String[] parseConfigAttr(NamedNodeMap attributes) { String key = attributes.getNamedItem("key").getTextContent(); String value = attributes.getNamedItem("value").getTextContent(); return new String[] { key, value }; } }