Example #1
0
  /**
   * Parse the catalog file to get catalog map.
   *
   * @param ditaDir absolute path to directory to find catalog-dita.xml
   * @return catalog map
   * @deprecated use Apache Commons Catalog Resolver instead
   */
  @Deprecated
  public static synchronized HashMap<String, String> getCatalog(final File ditaDir) {
    if (map != null) {
      return map;
    }

    final File catalogFilePath =
        (ditaDir == null) ? new File(FILE_NAME_CATALOG) : new File(ditaDir, FILE_NAME_CATALOG);

    map = new HashMap<String, String>();
    final CatalogParser parser = new CatalogParser(map, ditaDir.getAbsolutePath());
    try {
      final XMLReader reader = StringUtils.getXMLReader();
      reader.setContentHandler(parser);
      reader.parse(catalogFilePath.toURI().toASCIIString());
    } catch (final Exception e) {
      logger.logException(e);
    }

    return map;
  }