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

        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < value.size(); i++) {
            buf.append(value.get(i) ? "1 " : "0 ");
        }
        
        if (buf.length() > 0) {
            //remove last space
            buf.setLength(buf.length() - 1);
        }
        
        XMLUtils.setAttribute(currentElement, name, buf.toString());
    }
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