sourcePath = new File(xmlPath + source).getCanonicalPath();
sourcePath = xmlPath + source;
    private TileSet unmarshalTileset(Node t) throws Exception {        TileSet set = null;        boolean hasTileTags = false;        try {            set = (TileSet)unmarshalClass(TileSet.class, t);        } catch (Exception e) {            e.printStackTrace();        }        int tileWidth = getAttribute(t, "tilewidth", 0);        int tileHeight = getAttribute(t, "tileheight", 0);        int tileSpacing = getAttribute(t, "spacing", 0);        if (set.getSource() != null) {            TileSet ext = unmarshalTilesetFile(new FileInputStream(                        xmlPath + set.getSource()), xmlPath + set.getSource());            ext.setFirstGid(set.getFirstGid());            return ext;        } else {            NodeList children = t.getChildNodes();            // Do an initial pass to see if any tile tags are specified            for (int i = 0; i < children.getLength(); i++) {                Node child = children.item(i);                if (child.getNodeName().equalsIgnoreCase("tile")) {                    hasTileTags = true;                }            }            for (int i = 0; i < children.getLength(); i++) {                Node child = children.item(i);                if (child.getNodeName().equalsIgnoreCase("tile")) {                    set.addTile(unmarshalTile(child));                } else if (child.getNodeName().equalsIgnoreCase("image")) {                    String source = getAttributeValue(child, "source");                    if (source != null && getAttributeValue(child, "id") == null) {                        // Not a shared image, but a entire set in one image                        // file                        File sourceFile = new File(source);                        String sourcePath;                        if (sourceFile.getAbsolutePath().equals(source)) {                            sourcePath = sourceFile.getCanonicalPath();                        } else {                            sourcePath =                                new File(xmlPath + source).getCanonicalPath();                        }                        set.importTileBitmap(sourcePath, tileWidth, tileHeight,                                tileSpacing, !hasTileTags);                        // There can be only one tileset image                        //break;                    } else {                        set.addImage(unmarshalImage(child),                                getAttributeValue(child, "id"));                    }                }            }        }        return set;    }