@Override
    public void write(Savable[] value, String name, Savable[] defVal) throws IOException {
        if (value == null || Arrays.equals(value, defVal)) {
            return;
        }

        Element old = currentElement;
        
        appendElement(name);

        XMLUtils.setAttribute(currentElement, XMLExporter.ATTRIBUTE_SIZE, String.valueOf(value.length));
        for (int i = 0; i < value.length; i++) {
            Savable o = value[i];
            String elementName = "savable_" + i;
            if(o == null){
                // renderStateList has special loading code, so we can leave out the null values
                if(!name.equals("renderStateList")){
                    Element before = currentElement;
                    appendElement(elementName);
                    currentElement = before;
                }
            }else{
                write(o, elementName, null);
            }
        }

        currentElement = old;
    }
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