private List<Element> getObjectArrayElements(Element element) throws IOException {
        if (element == null) {
            return null;
        }

        String sizeString = XMLUtils.getAttribute(importer.getFormatVersion(), element, XMLExporter.ATTRIBUTE_SIZE);

        if (sizeString.isEmpty()) {
            return null;
        }

        NodeList nodes = element.getChildNodes();

        List<Element> elements = new ArrayList<>();
        for (int i = 0; i < nodes.getLength(); i++) {
            Node node = nodes.item(i);
            if (node instanceof Element) {
                elements.add((Element) node);
            }
        }

        try {
            int requiredSize = Integer.parseInt(sizeString);
            if (elements.size() != requiredSize) {
                throw new IOException("DOMInputCapsule.getObjectArrayElements(): Wrong element count for '" + element.getTagName()
                        + "'.  size says " + requiredSize
                        + ", data contains "
                        + elements.size());
            }
        } catch (NumberFormatException ex) {
            throw new IOException("Invalid size for '" + element.getTagName() + "': " + sizeString);
        }

        return elements;
    }
Part of the jME XML IO system as introduced in the Google Code jmexml project.

@author Kai Rabien (hevee) - original author of the code.google.com jmexml project
@author Doug Daniels (dougnukem) - adjustments for jME 2.0 and Java 1.5
@author blaine
jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java