/** * Writes a reference to an external tileset into a XML document. In the case where the tileset is * not stored in an external file, writes the contents of the tileset instead. * * @param set the tileset to write a reference to * @param w the XML writer to write to * @param wp the working directory of the map * @throws java.io.IOException */ private void writeTilesetReference(TileSet set, XMLWriter w, String wp) throws IOException { String source = set.getSource(); if (source == null) { writeTileset(set, w, wp); } else { w.startElement("tileset"); w.writeAttribute("firstgid", getFirstGidForTileset(set)); w.writeAttribute("source", getRelativePath(wp, source)); if (set.getBaseDir() != null) { w.writeAttribute("basedir", set.getBaseDir()); } w.endElement(); } }