// Get the map dimensions and create the map
int mapWidth = getAttribute(mapNode, "width", 0);
int mapHeight = getAttribute(mapNode, "height", 0);
if (mapWidth > 0 && mapHeight > 0) {
map = new Map(mapWidth, mapHeight);
} else {
// Maybe this map is still using the dimensions element
NodeList l = doc.getElementsByTagName("dimensions");
for (int i = 0; (item = l.item(i)) != null; i++) {
if (item.getParentNode() == mapNode) {
mapWidth = getAttribute(item, "width", 0);
mapHeight = getAttribute(item, "height", 0);
if (mapWidth > 0 && mapHeight > 0) {
map = new Map(mapWidth, mapHeight);
}
}
}
}