public void getBuildings() {
		String filename = "buildings.xml";
		Document doc = getXmlFile(pathToXml + filename);

		try {
			NodeList allBuildings = doc.getElementsByTagName("building");

			for (int i = 0; i < allBuildings.getLength(); i++) {
				Element building = (Element) allBuildings.item(i);

				// Name
				String name = building.getAttribute("name");

				// Max level
				int maxLevel = Integer.parseInt(getTagValue("maxLevel", building));

				// Level prices
				Price[] levelPrices = new Price[maxLevel];
				Element prices = (Element) building.getElementsByTagName("prices").item(0);
				NodeList priceList = prices.getElementsByTagName("price");
				for (int j = 0; j < maxLevel; j++) {

					Element price = null;
					for (int k = 0; k < maxLevel; k++) {
						Element e = (Element) priceList.item(k);
						if (Integer.parseInt(e.getAttribute("level")) == j + 1) {
							price = e;
							break;
						}
					}
					levelPrices[j] = parsePrice(price, factory);
				}

				// Level units
				String[] levelUnits = new String[maxLevel];
				Element units = (Element) building.getElementsByTagName("units").item(0);
				NodeList unitList = units.getElementsByTagName("unit");
				for (int j = 0; j < maxLevel; j++) {

					Element unit = null;
					for (int k = 0; k < maxLevel; k++) {
						Element e = (Element) unitList.item(k);
						if (Integer.parseInt(e.getAttribute("level")) == j + 1) {
							unit = e;
							break;
						}
					}
					levelUnits[j] = unit.getTextContent();
				}

				BuildingPattern pattern = new BuildingPattern(name, maxLevel, levelPrices, levelUnits);
				BuildingCreator.addBuildingPattern(name, pattern);
			}
		} catch (NullPointerException e) {
			System.err.println("XML syntax error in " + filename);
			e.printStackTrace();
		}
	}