@Override
    public void writeSavableMap(Map<? extends Savable, ? extends Savable> map, String name, Map<? extends Savable, ? extends Savable> defVal) throws IOException {
        if (map == null || map.equals(defVal)) {
            return;
        }

        Element stringMap = appendElement(name);

        Iterator<? extends Savable> keyIterator = map.keySet().iterator();
        while(keyIterator.hasNext()) {
            Savable key = keyIterator.next();
            Element mapEntry = appendElement(XMLExporter.ELEMENT_MAPENTRY);
            write(key, XMLExporter.ELEMENT_KEY, null);
            Savable value = map.get(key);
            write(value, XMLExporter.ELEMENT_VALUE, null);
            currentElement = stringMap;
        }

        currentElement = (Element) stringMap.getParentNode();
    }
appends a new Element with the given name to currentElement, sets
currentElement to be new Element, and returns the new Element as well
jme3-plugins/src/xml/java/com/jme3/export/xml/DOMOutputCapsule.java