protected void readAttributes(XMLStreamReader in)
        throws XMLStreamException {
        String newTypeId = in.getAttributeValue(null, "unit");
        if (newTypeId == null) {
            newUnitType = null;
        } else {
            newUnitType = getSpecification().getType(newTypeId, UnitType.class);
            turnsToLearn = getAttribute(in, "turnsToLearn", UNDEFINED);
            if (turnsToLearn > 0) {
                changeTypes.put(ChangeType.EDUCATION, 100);
            }
            // @compat 0.9.x
            for (ChangeType type : ChangeType.values()) {
                String value = in.getAttributeValue(null, tags.get(type));
                if (value != null) {
                    if(value.equalsIgnoreCase("false")) {
                        changeTypes.put(type, 0);
                    } else if (value.equalsIgnoreCase("true")) {
                        changeTypes.put(type, 100);
                    } else {
                        changeTypes.put(type, Math.max(0,
                                Math.min(100, new Integer(value))));
                    }
                }
            }
            // end compatibility code
        }
    }