 			
 			case "data":
 				currentData = ""
+				currentEncoding = ""
+				currentCompression = ""
+				
+				if let value = attributes["encoding"] as? String
+				{
+					currentEncoding = value
+				}
+				
+				if let value = attributes["compression"] as? String
+				{
+					currentCompression = value
+				}
 			
 			default:
 				break

			assert(uncompressedLength == width * height * 4)
			
			return parseData(uncompressedBuffer)
		}
		else
		{
			// uncompressed base64
			
			let data = NSData(base64EncodedString: string, options: .Encoding64CharacterLineLength)
			assert(data.length == width * height * 4)
			
			var bytes = UInt8[](count: data.length, repeatedValue: 0)
			data.getBytes(&bytes, length: data.length)
			
			return parseData(bytes)
		}
	}
	
	*/
	
	func parseArray(data: [String]) -> [[LGTile]]
	{

		return map
	}
	
	
	func parseString(string: String, encoding: String, compression: String) -> [[LGTile]]
	{
		assert(encoding == "csv" || encoding == "base64",	"Encoding must be csv or base64!")
		assert(encoding != "csv" || compression == "",		"csv-encoded strings cannot be compressed!")
		assert(compression == "",				"Compression is not yet supported!")
		
		// TODO: add support for compression (probably zlib)
		
		if encoding == "csv"
		{
			// uncompressed csv
			
			let arr = string.componentsSeparatedByString(",")
			assert(arr.count == width * height)
			
			return parseArray(arr)
		}
		/* else if compression == "zlib"
		{
			// zlib compressed base64
			
			var uncompressedBuffer = [UInt8](count: Int(width * height * 4), repeatedValue: 0)
			var uncompressedLength: Int!
			
			let data = NSData(base64EncodedString: string, options: .Encoding64CharacterLineLength)
