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

        Element stringMap = appendElement(name);

        for(Entry<? extends Savable> entry : map) {
            int key = entry.getKey();
            Element mapEntry = appendElement("MapEntry");
            XMLUtils.setAttribute(mapEntry, "key", Integer.toString(key));
            Savable s = entry.getValue();
            write(s, "Savable", 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