Package org.apache.xml.resolver

Examples of org.apache.xml.resolver.CatalogManager


    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(sourceDirectory);
    scanner.setIncludes(getIncludes());
    scanner.scan();
    String[] included = scanner.getIncludedFiles();
    CatalogManager catalogManager = createCatalogManager();
    CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
    URIResolver uriResolver = null;
    try {
      URL url = getNonDefaultStylesheetURL() == null ? getDefaultStylesheetURL()
          : getNonDefaultStylesheetURL();
View Full Code Here


   *
   * @return A <code>CatalogManager</code> to be used for resolving DTDs and
   *         other entities.
   */
  protected CatalogManager createCatalogManager() {
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    ClassLoader classLoader = Thread.currentThread()
        .getContextClassLoader();
    StringBuffer builder = new StringBuffer();
    boolean first = true;
    try {
      Enumeration enumeration = classLoader.getResources("/catalog.xml");
      while (enumeration.hasMoreElements()) {
        if (!first) {
          builder.append(';');
        } else {
          first = false;
        }
        URL resource = (URL) enumeration.nextElement();
        builder.append(resource.toExternalForm());
      }
    } catch (IOException ioe) {
      getLog().warn("Failed to search for catalog files.");
      // Let's be a little tolerant here.
    }
    String catalogFiles = builder.toString();
    if (catalogFiles.length() == 0) {
      getLog().warn("Failed to find catalog files.");
    } else {
      manager.setCatalogFiles(catalogFiles);
    }
    return manager;
  }
View Full Code Here

        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setBasedir(sourceDirectory);
        scanner.setIncludes(getIncludes());
        scanner.scan();
        String[] included = scanner.getIncludedFiles();
        CatalogManager catalogManager = createCatalogManager();
        CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
        URIResolver uriResolver = null;
        try {
            URL url = getNonDefaultStylesheetURL() == null ? getDefaultStylesheetURL()
                    : getNonDefaultStylesheetURL();
View Full Code Here

     *
     * @return A <code>CatalogManager</code> to be used for resolving DTDs and
     *         other entities.
     */
    protected CatalogManager createCatalogManager() {
        CatalogManager manager = new CatalogManager();
        manager.setIgnoreMissingProperties(true);
        ClassLoader classLoader = Thread.currentThread()
                .getContextClassLoader();
        StringBuffer builder = new StringBuffer();
        boolean first = true;
        try {
            Enumeration enumeration = classLoader.getResources("/catalog.xml");
            while (enumeration.hasMoreElements()) {
                if (!first) {
                    builder.append(';');
                } else {
                    first = false;
                }
                URL resource = (URL) enumeration.nextElement();
                builder.append(resource.toExternalForm());
            }
        } catch (IOException ioe) {
            getLog().warn("Failed to search for catalog files.");
            // Let's be a little tolerant here.
        }
        String catalogFiles = builder.toString();
        if (catalogFiles.length() == 0) {
            getLog().warn("Failed to find catalog files.");
        } else {
            manager.setCatalogFiles(catalogFiles);
        }
        return manager;
    }
View Full Code Here

        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setBasedir(sourceDirectory);
        scanner.setIncludes(getIncludes());
        scanner.scan();
        String[] included = scanner.getIncludedFiles();
        CatalogManager catalogManager = createCatalogManager();
        CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
        URIResolver uriResolver = null;
        try {
            URL url = getNonDefaultStylesheetURL() == null ? getDefaultStylesheetURL()
                    : getNonDefaultStylesheetURL();
View Full Code Here

     *
     * @return A <code>CatalogManager</code> to be used for resolving DTDs and
     *         other entities.
     */
    protected CatalogManager createCatalogManager() {
        CatalogManager manager = new CatalogManager();
        manager.setIgnoreMissingProperties(true);
        ClassLoader classLoader = Thread.currentThread()
                .getContextClassLoader();
        StringBuffer builder = new StringBuffer();
        boolean first = true;
        try {
            Enumeration enumeration = classLoader.getResources("/catalog.xml");
            while (enumeration.hasMoreElements()) {
                if (!first) {
                    builder.append(';');
                } else {
                    first = false;
                }
                URL resource = (URL) enumeration.nextElement();
                builder.append(resource.toExternalForm());
            }
        } catch (IOException ioe) {
            getLog().warn("Failed to search for catalog files.");
            // Let's be a little tolerant here.
        }
        String catalogFiles = builder.toString();
        if (catalogFiles.length() == 0) {
            getLog().warn("Failed to find catalog files.");
        } else {
            manager.setCatalogFiles(catalogFiles);
        }
        return manager;
    }
View Full Code Here

            }
        } catch (IOException e) {
            LOG.warn("Failed to open OASIS catalog", e);
        }
       
        CatalogManager catalogManager = new CatalogManager();
        catalogManager.setUseStaticCatalog(false);
        catalogManager.setIgnoreMissingProperties(true);
        CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
        Catalog catalog = catalogResolver.getCatalog();
       
        if (catalogURI != null) {
            LOG.debug("Found OASIS catalog {} ", catalogURI);
View Full Code Here

    }

    final String[] included = scanIncludedFiles();

    // configure a resolver for catalog files
    final CatalogManager catalogManager = createCatalogManager();
    final CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
    // configure a resolver for urn:dockbx:stylesheet
    final URIResolver uriResolver = createStyleSheetResolver(catalogResolver);
    // configure a resolver for xml entities
    final InjectingEntityResolver injectingResolver = createEntityResolver(catalogResolver);
View Full Code Here

   * Creates a <code>CatalogManager</code>, used to resolve DTDs and other entities.
   *
   * @return A <code>CatalogManager</code> to be used for resolving DTDs and other entities.
   */
  protected CatalogManager createCatalogManager() {
    CatalogManager manager = new CatalogManager();
    manager.setIgnoreMissingProperties(true);
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    StringBuffer builder = new StringBuffer();
    boolean first = true;
    for (int i = 0; i < catalogs.length; i++) {
      final String catalog = catalogs[i];
      try {
        Enumeration enumeration = classLoader.getResources(catalog);
        while (enumeration.hasMoreElements()) {
          if (!first) {
            builder.append(';');
          } else {
            first = false;
          }
          URL resource = (URL) enumeration.nextElement();
          builder.append(resource.toExternalForm());
        }
      } catch (IOException ioe) {
        getLog().warn("Failed to search for catalog files: " + catalog);
        // Let's be a little tolerant here.
      }
    }

    String catalogFiles = builder.toString();
    if (catalogFiles.length() == 0) {
      getLog().warn("Failed to find catalog files.");
    } else {
      if (getLog().isDebugEnabled()) {
        getLog().debug("Catalogs to load: " + catalogFiles);
      }
      manager.setCatalogFiles(catalogFiles);
    }
    return manager;
  }
View Full Code Here

     * @param catalogLocation
     *            URL of OASIS Catalog
     * @return a private Catalog
     */
    static Catalog buildPrivateCatalog(URL catalogLocation) {
        CatalogManager catalogManager = new CatalogManager();
        catalogManager.setUseStaticCatalog(false);
        catalogManager.setVerbosity(0);
        catalogManager.setIgnoreMissingProperties(true);
        Catalog catalog = catalogManager.getCatalog();
        try {
            catalog.parseCatalog(catalogLocation);
        } catch (IOException e) {
            throw new RuntimeException("Error trying to load OASIS catalog from URL "
                    + catalogLocation.toString(), e);
View Full Code Here

TOP

Related Classes of org.apache.xml.resolver.CatalogManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.