public static void parseMapFile(String mapFilePath, final Tilemap result) {
		try {
			if (LOGGER.isDebugEnabled())
				LOGGER.debug("Trying to load map: " + mapFilePath);

			SAXParserFactory factory = SAXParserFactory.newInstance();
			SAXParser saxParser = factory.newSAXParser();

			saxParser.parse(MapUtil.class.getResource("/" + mapFilePath).getFile(), new DefaultHandler() {
				private String			tilesetPath		= null;
				private int				firstGid		= 0;
				private int				tilesetWidth	= 0;
				private int				tilesetHeight	= 0;
				private List<Integer>	tileIndex		= new ArrayList<Integer>();

				@Override
				public void startElement(String uri, String localName, String elementName, Attributes attributes) throws SAXException {

					int length = attributes.getLength();
					for (int index = 0; index < length; ++index) {
						parseAttribute(elementName, attributes.getLocalName(index), attributes.getValue(index));
					}
				}

				@Override
				public void endElement(String uri, String localName, String elementName) throws SAXException {
					switch (elementName) {
						case (XML_NODE_TILESET_KEY): {
							if (tilesetPath != null && firstGid > 0 && tilesetWidth > 0 && tilesetHeight > 0) {
								// completed parsing of an entire tileset
								result.addTileset(tilesetPath, tilesetWidth, tilesetHeight, firstGid);

								tilesetPath = null;
								firstGid = tilesetWidth = tilesetHeight = 0;
							}
							break;
						}
						case (XML_NODE_DATA_KEY): {
							// completed parsing of an entire tilesetindex section
							result.addTileIndex(tileIndex);
							tileIndex.clear();
							break;
						}
					}
				}

				private void parseAttribute(String elementName, String attribute, String value) {
					switch (elementName) {
						case (XML_NODE_MAP_KEY): {
							// parse general map attributes
							switch (attribute) {
								case (XML_WIDTH_KEY): {
									result.setWidth(Integer.parseInt(value));
									break;
								}
								case (XML_HEIGHT_KEY): {
									result.setHeight(Integer.parseInt(value));
									break;
								}
								case (XML_TILE_WIDTH_KEY): {
									result.setTileWidth(Integer.parseInt(value));
									break;
								}
								case (XML_TILE_HEIGHT_KEY): {
									result.setTileHeight(Integer.parseInt(value));
									break;
								}
							}
							break;
						}
						case (XML_NODE_TILESET_KEY): {
							// parse tileset specific attributes
							switch (attribute) {
								case (XML_FIRST_GID_KEY): {
									firstGid = Integer.parseInt(value);
									break;
								}
							}
							break;
						}
						case (XML_NODE_IMAGE_KEY): {
							// parse tileset image specific attributes
							switch (attribute) {
								case (XML_TILESET_PATH_KEY): {
									tilesetPath = value;
									tilesetPath = tilesetPath.substring(tilesetPath.indexOf("resources"));
									break;
								}
								case (XML_WIDTH_KEY): {
									tilesetWidth = Integer.parseInt(value);
									break;
								}
								case (XML_HEIGHT_KEY): {
									tilesetHeight = Integer.parseInt(value);
									break;
								}
							}
							break;
						}
						case (XML_NODE_TILE_KEY): {
							// parse tileindex specific attributes
							tileIndex.add(Integer.parseInt(value));
							break;
						}
					}
				}
			});
		} catch (Exception e) {
			LOGGER.fatal("Error while parsing mapfile: " + mapFilePath, e);
		}

		if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("Finished parsing of mapfile: " + mapFilePath);
			LOGGER.debug("Width: " + result.getWidth());
			LOGGER.debug("Height: " + result.getHeight());
			LOGGER.debug("Tilewidth: " + result.getTileWidth());
			LOGGER.debug("Tileheight: " + result.getTileHeight());
		}
	}