private void load(InputStream in, String tileSetsLocation) throws SlickException {
		tilesLocation = tileSetsLocation;
		
		try {
			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
			factory.setValidating(false);
			DocumentBuilder builder = factory.newDocumentBuilder();
			builder.setEntityResolver(new EntityResolver() {
				public InputSource resolveEntity(String publicId,
						String systemId) throws SAXException, IOException {					
					return new InputSource(new ByteArrayInputStream(new byte[0]));
				}
			});
			
			Document doc = builder.parse(in);
			Element docElement = doc.getDocumentElement();
			
			String orient = docElement.getAttribute("orientation");
			if (!orient.equals("orthogonal")) {
				throw new SlickException("Only orthogonal maps supported, found: "+orient);
			}
			
			width = Integer.parseInt(docElement.getAttribute("width"));
			height = Integer.parseInt(docElement.getAttribute("height"));
			tileWidth = Integer.parseInt(docElement.getAttribute("tilewidth"));
			tileHeight = Integer.parseInt(docElement.getAttribute("tileheight"));
			
			// now read the map properties
			Element propsElement = (Element) docElement.getElementsByTagName("properties").item(0);
			if (propsElement != null) {
				NodeList properties = propsElement.getElementsByTagName("property");
				if (properties != null) {
					props = new Properties();
					for (int p = 0; p < properties.getLength();p++) {
						Element propElement = (Element) properties.item(p);
						
						String name = propElement.getAttribute("name");
						String value = propElement.getAttribute("value");		
						props.setProperty(name, value);
					}
				}
			}
			
			if (loadTileSets) {
				TileSet tileSet = null;
				TileSet lastSet = null;
				
				NodeList setNodes = docElement.getElementsByTagName("tileset");
				for (int i=0;i<setNodes.getLength();i++) {
					Element current = (Element) setNodes.item(i);
					
					tileSet = new TileSet(this, current);
					tileSet.index = i;
					
					if (lastSet != null) {
						lastSet.setLimit(tileSet.firstGID-1);
					}
					lastSet = tileSet;
					
					tileSets.add(tileSet);
				}
			}
			
			NodeList layerNodes = docElement.getElementsByTagName("layer");
			for (int i=0;i<layerNodes.getLength();i++) {
				Element current = (Element) layerNodes.item(i);
				Layer layer = new Layer(this, current);
				layer.index = i;
				
				layers.add(layer);
			}
		} catch (Exception e) {
			Log.error(e);
			throw new SlickException("Failed to parse tilemap", e);
		}
	}