@Test (expected = IllegalArgumentException.class) public void testParseMapWithoutTilesets () throws TiledParserException { TmxMapParser.parse(new File("../data/junit/tmx-parser/testmap-without-tilesets.tmx")); }
public static TiledMap parse (File tmxFile) throws TiledParserException { Objects.requireNonNull(tmxFile); if (!tmxFile.exists()) { throw new TiledParserException("tmx map file doesn't exists: " + tmxFile.getAbsolutePath()); } Document doc = null; try { doc = getDoc(tmxFile); } catch (DocumentException e) { Log.e(LOG_TAG, ""); throw new IllegalStateException("Cannot parse tmx file: " + tmxFile.getAbsolutePath()); } Element rootElement = doc.getRootElement(); String tmxFormatVersion = rootElement.attributeValue("version"); if (!isSupportedVersion(tmxFormatVersion)) { throw new TiledParserException("Unknown tmx format version '" + tmxFormatVersion + "': " + tmxFile.getAbsolutePath()); } String tmxDir = tmxFile.getParentFile().getAbsolutePath().replace("\\", "/") + "/"; return TmxParser.parse(doc, rootElement, tmxDir); }
TmxMapParser { public static TiledMap parse (File tmxFile) throws TiledParserException { Objects.requireNonNull(tmxFile); if (!tmxFile.exists()) { throw new TiledParserException("tmx map file doesn't exists: " + tmxFile.getAbsolutePath()); } Document doc = null; try { doc = getDoc(tmxFile); } catch (DocumentException e) { Log.e(LOG_TAG, ""); throw new IllegalStateException("Cannot parse tmx file: " + tmxFile.getAbsolutePath()); } Element rootElement = doc.getRootElement(); String tmxFormatVersion = rootElement.attributeValue("version"); if (!isSupportedVersion(tmxFormatVersion)) { throw new TiledParserException("Unknown tmx format version '" + tmxFormatVersion + "': " + tmxFile.getAbsolutePath()); } String tmxDir = tmxFile.getParentFile().getAbsolutePath().replace("\\", "/") + "/"; return TmxParser.parse(doc, rootElement, tmxDir); } }
TmxMapParser { public static TiledMap parse (File tmxFile) throws TiledParserException { Objects.requireNonNull(tmxFile); if (!tmxFile.exists()) { throw new TiledParserException("tmx map file doesn't exists: " + tmxFile.getAbsolutePath()); } Document doc = null; try { doc = getDoc(tmxFile); } catch (DocumentException e) { Log.e(LOG_TAG, ""); throw new IllegalStateException("Cannot parse tmx file: " + tmxFile.getAbsolutePath()); } Element rootElement = doc.getRootElement(); String tmxFormatVersion = rootElement.attributeValue("version"); if (!isSupportedVersion(tmxFormatVersion)) { throw new TiledParserException("Unknown tmx format version '" + tmxFormatVersion + "': " + tmxFile.getAbsolutePath()); } String tmxDir = tmxFile.getParentFile().getAbsolutePath().replace("\\", "/") + "/"; return TmxParser.parse(doc, rootElement, tmxDir); } protected  TmxMapParser(); }
TmxMapParser { public static TiledMap parse (File tmxFile) throws TiledParserException { Objects.requireNonNull(tmxFile); if (!tmxFile.exists()) { throw new TiledParserException("tmx map file doesn't exists: " + tmxFile.getAbsolutePath()); } Document doc = null; try { doc = getDoc(tmxFile); } catch (DocumentException e) { Log.e(LOG_TAG, ""); throw new IllegalStateException("Cannot parse tmx file: " + tmxFile.getAbsolutePath()); } Element rootElement = doc.getRootElement(); String tmxFormatVersion = rootElement.attributeValue("version"); if (!isSupportedVersion(tmxFormatVersion)) { throw new TiledParserException("Unknown tmx format version '" + tmxFormatVersion + "': " + tmxFile.getAbsolutePath()); } String tmxDir = tmxFile.getParentFile().getAbsolutePath().replace("\\", "/") + "/"; return TmxParser.parse(doc, rootElement, tmxDir); } protected  TmxMapParser(); static TiledMap parse(File tmxFile); }
TmxMapParser { public static TiledMap parse (File tmxFile) throws TiledParserException { Objects.requireNonNull(tmxFile); if (!tmxFile.exists()) { throw new TiledParserException("tmx map file doesn't exists: " + tmxFile.getAbsolutePath()); } Document doc = null; try { doc = getDoc(tmxFile); } catch (DocumentException e) { Log.e(LOG_TAG, ""); throw new IllegalStateException("Cannot parse tmx file: " + tmxFile.getAbsolutePath()); } Element rootElement = doc.getRootElement(); String tmxFormatVersion = rootElement.attributeValue("version"); if (!isSupportedVersion(tmxFormatVersion)) { throw new TiledParserException("Unknown tmx format version '" + tmxFormatVersion + "': " + tmxFile.getAbsolutePath()); } String tmxDir = tmxFile.getParentFile().getAbsolutePath().replace("\\", "/") + "/"; return TmxParser.parse(doc, rootElement, tmxDir); } protected  TmxMapParser(); static TiledMap parse(File tmxFile);  }