private static void tryToSetMap(Object object, Node param) throws TikaConfigException {
        String name = param.getLocalName();
        //only supports string, string at this point
        //use LinkedHashMap to keep insertion order!
        Map<String, String> map = new LinkedHashMap<>();
        NodeList nodeList = param.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node n = nodeList.item(i);
            if (n.getNodeType() == 1) {
                NamedNodeMap m = n.getAttributes();
                String key = null;
                String value = null;
                if (m.getNamedItem("from") != null) {
                    key = m.getNamedItem("from").getTextContent();
                } else if (m.getNamedItem("key") != null) {
                    key = m.getNamedItem("key").getTextContent();
                } else if (m.getNamedItem("k") != null) {
                    key = m.getNamedItem("k").getTextContent();
                }

                if (m.getNamedItem("to") != null) {
                    value = m.getNamedItem("to").getTextContent();
                } else if (m.getNamedItem("value") != null) {
                    value = m.getNamedItem("value").getTextContent();
                } else if (m.getNamedItem("v") != null) {
                    value = m.getNamedItem("v").getTextContent();
                }
                if (key == null) {
                    throw new TikaConfigException(
                            "must specify a 'key' or 'from' value in a map " + "object : " + param);
                }
                if (value == null) {
                    throw new TikaConfigException(
                            "must specify a 'value' or 'to' value in a " + "map object : " + param);
                }
                map.put(key, value);
            }

        }
        String setter = "set" + name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1);
        try {
            Method m = object.getClass().getMethod(setter, Map.class);
            m.invoke(object, map);
        } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
            throw new TikaConfigException("can't set " + name, e);
        }
    }
Use this to build a list of components for a composite item (e.g.
CompositeMetadataFilter, FetcherManager), each with their own configurations

@param compositeElementName
@param itemName
@param is
@throws TikaConfigException
@throws IOException
tika-core/src/main/java/org/apache/tika/config/ConfigBase.java