warnings.push("INFO: defaulting layer '"+ml.getName()+"' dimensions to map dimensions");
    private MapLayer unmarshalLayer(Node t) throws Exception {        TileLayer ml = null;        boolean encodedBase64 = false;        try {            ml = (TileLayer)unmarshalClass(TileLayer.class, t);        } catch (Exception e) {            e.printStackTrace();        }        Rectangle r = ml.getBounds();        if(r.height == 0 && r.width == 0) {            ml.setBounds(map.getBounds());        }                NodeList children = t.getChildNodes();        for (int i = 0; i < children.getLength(); i++) {            Node child = children.item(i);            if (child.getNodeName().equalsIgnoreCase("data")) {                String encoding = getAttributeValue(child, "encoding");                if (encoding != null && encoding.equalsIgnoreCase("base64")) {                    Node cdata = child.getChildNodes().item(0);                    char[] enc = cdata.getNodeValue().trim().toCharArray();                    byte[] dec = Base64.decode(enc);                    ByteArrayInputStream bais = new ByteArrayInputStream(dec);                    InputStream is;                    String comp = getAttributeValue(child, "compression");                    if (comp != null && comp.equalsIgnoreCase("gzip")) {                        is = new GZIPInputStream(bais);                    } else {                        is = bais;                    }                    for (int y = 0; y < ml.getHeight(); y++) {                        for (int x = 0; x < ml.getWidth(); x++) {                            int tileId = 0;                            tileId |= is.read();                            tileId |= is.read() <<  8;                            tileId |= is.read() << 16;                            tileId |= is.read() << 24;                            TileSet ts = map.findTileSetForTileGID(tileId);                            if (ts != null) {                                ml.setTileAt(x, y,                                        ts.getTile(tileId - ts.getFirstGid()));                            } else {                                ml.setTileAt(x, y, map.getNullTile());                            }                        }                    }                } else {                    int x = 0, y = 0;                    NodeList dataChilds = child.getChildNodes();                    NodeList tilelist = doc.getElementsByTagName("tile");                    for (int j = 0; j < dataChilds.getLength(); j++) {                        Node dataChild = dataChilds.item(j);                        if (dataChild.getNodeName().equalsIgnoreCase("tile")) {                            int tileId = getAttribute(dataChild, "gid", -1);                            TileSet ts = map.findTileSetForTileGID(tileId);                            if (ts != null) {                                ml.setTileAt(x, y,                                        ts.getTile(tileId - ts.getFirstGid()));                            } else {                                ml.setTileAt(x, y, map.getNullTile());                            }                            x++;                            if (x == ml.getWidth()) { x = 0; y++; }                            if (y == ml.getHeight()) { break; }                        }                    }                }            } else if (child.getNodeName().equalsIgnoreCase("property")) {                ml.setProperty(getAttributeValue(child,"name"),                        getAttributeValue(child, "value"));            }        }        return ml;    }