private Object readPrimitiveArrayHelper(Element element, String primType) throws IOException {
        if (element == null) {
            return null;
        }

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

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

        String[] tokens = parseTokens(XMLUtils.getAttribute(importer.getFormatVersion(), element, XMLExporter.ATTRIBUTE_DATA));

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

        try {
            switch (primType) {
                case "byte":
                    byte[] byteArray = new byte[tokens.length];
                    for (int i = 0; i < tokens.length; i++) byteArray[i] = Byte.parseByte(tokens[i]);
                    return byteArray;
                case "short":
                    short[] shortArray = new short[tokens.length];
                    for (int i = 0; i < tokens.length; i++) shortArray[i] = Short.parseShort(tokens[i]);
                    return shortArray;
                case "int":
                    int[] intArray = new int[tokens.length];
                    for (int i = 0; i < tokens.length; i++) intArray[i] = Integer.parseInt(tokens[i]);
                    return intArray;
                case "long":
                    long[] longArray = new long[tokens.length];
                    for (int i = 0; i < tokens.length; i++) longArray[i] = Long.parseLong(tokens[i]);
                    return longArray;
                case "float":
                    float[] floatArray = new float[tokens.length];
                    for (int i = 0; i < tokens.length; i++) floatArray[i] = Float.parseFloat(tokens[i]);
                    return floatArray;
                case "double":
                    double[] doubleArray = new double[tokens.length];
                    for (int i = 0; i < tokens.length; i++) doubleArray[i] = Double.parseDouble(tokens[i]);
                    return doubleArray;
                case "boolean":
                    boolean[] booleanArray = new boolean[tokens.length];
                    for (int i = 0; i < tokens.length; i++) booleanArray[i] = Boolean.parseBoolean(tokens[i]);
                    return booleanArray;
                default:
                    throw new IOException();    // will never happen
            }
        } catch(NumberFormatException nfe) {
            throw new IOException(nfe);
        }
    }
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