public static WargusMap loadFromXML(Element e) {
    assert e.getName().equals("map") :
      "WargusMap.loadFromXML: Invalid XML Element " + e.getName();

    int width = Integer.parseInt(e.getChildText("size-x"));
    int height = Integer.parseInt(e.getChildText("size-y"));

    WargusMap map = new WargusMap(width, height);

    List goldElements = e.getChild("gold-mines").getChildren("unit");
    for (Object o : goldElements) {
      Element goldElement = (Element) o;
      map.add_goldMine(WargusUnit.loadFromXML(goldElement));
    }

    List oilElements = e.getChild("oil-fields").getChildren("unit");
    for (Object o : oilElements) {
      Element oilElement = (Element) o;
      map.add_oilPatch(WargusUnit.loadFromXML(oilElement));
    }

    int y = 0;
    for (Object o : e.getChild("terrain").getChildren("row")) {
      Element terrainRow = (Element) o;
      String row = terrainRow.getText();

      assert row.length() == width :
	"WargusMap.loadFromXML: Invalid terrain row size! " 
	+ terrainRow.getText().length();
      assert y < height : "WargusMap.loadFromXML: Too many terrain rows!";

      for (int x = 0; x < width; ++x) {
	map.set_map(x, y, row.charAt(x));
      }
      ++y;
    }

    for(WargusUnit gm : map.get_goldMines()) {
      for (int i = 0; i < 3; ++i) {
	for (int j = 0; j < 3; ++j) {
	  map.set_map(gm.getLocX() + i, gm.getLocY() + j, 
	      WargusStateImporter.TERRAIN_GOLD);
	}
      }
    }
    return map;
  }