public static BuildingData load(File f) throws AisIOException {
SAXBuilder sxb = new SAXBuilder();
try {
Document document = sxb.build(f);
Element root = document.getRootElement();
BuildingData data = new BuildingData();
List<Element> levels = root.getChild("levels").getChildren("level");
for (Element levelElement : levels) {
String value = levelElement.getAttributeValue("value");
Integer level = "".equals(value) ? 0 : Integer.valueOf(value);
data.putData(level, buildLevelData(levelElement));
}
return data;
} catch (NumberFormatException e) {
throw new AisIOException("Invalid file format for : " + f.getName());