Package org.apache.xml.resolver

Examples of org.apache.xml.resolver.Catalog


  }
      }
    }

    CatalogResolver catalogResolver = new CatalogResolver();
    Catalog resolver = catalogResolver.getCatalog();

    for (int count = 0; count < catalogFiles.size(); count++) {
      String file = (String) catalogFiles.elementAt(count);
      resolver.parseCatalog(file);
    }
    String result = null;

    if (resType == Catalog.DOCTYPE) {
      System.out.println("Resolve DOCTYPE (name, publicid, systemid):");
      if (name != null) { System.out.println("       name: " + name); }
      if (publicId != null) { System.out.println("  public id: " + publicId); }
      if (systemId != null) { System.out.println("  system id: " + systemId); }
      if (uri != null) { System.out.println("        uri: " + uri); }
      result = resolver.resolveDoctype(name, publicId, systemId);
    } else if (resType == Catalog.DOCUMENT) {
      System.out.println("Resolve DOCUMENT ():");
      result = resolver.resolveDocument();
    } else if (resType == Catalog.ENTITY) {
      System.out.println("Resolve ENTITY (name, publicid, systemid):");
      if (name != null) { System.out.println("       name: " + name); }
      if (publicId != null) { System.out.println("  public id: " + publicId); }
      if (systemId != null) { System.out.println("  system id: " + systemId); }
      result = resolver.resolveEntity(name, publicId, systemId);
    } else if (resType == Catalog.NOTATION) {
      System.out.println("Resolve NOTATION (name, publicid, systemid):");
      if (name != null) { System.out.println("       name: " + name); }
      if (publicId != null) { System.out.println("  public id: " + publicId); }
      if (systemId != null) { System.out.println("  system id: " + systemId); }
      result = resolver.resolveNotation(name, publicId, systemId);
    } else if (resType == Catalog.PUBLIC) {
      System.out.println("Resolve PUBLIC (publicid, systemid):");
      if (publicId != null) { System.out.println("  public id: " + publicId); }
      if (systemId != null) { System.out.println("  system id: " + systemId); }
      result = resolver.resolvePublic(publicId, systemId);
    } else if (resType == Catalog.SYSTEM) {
      System.out.println("Resolve SYSTEM (systemid):");
      if (systemId != null) { System.out.println("  system id: " + systemId); }
      result = resolver.resolveSystem(systemId);
    } else if (resType == Catalog.URI) {
      System.out.println("Resolve URI (uri):");
      if (uri != null) { System.out.println("        uri: " + uri); }
      result = resolver.resolveURI(uri);
    } else {
      System.out.println("resType is wrong!? This can't happen!");
      usage();
    }
View Full Code Here


    }

    ResolvingParser.validating = validating;
    ResolvingParser.namespaceAware = nsAware;
    ResolvingParser reader = new ResolvingParser();
    Catalog catalog = reader.getCatalog();

    for (int count = 0; count < catalogFiles.size(); count++) {
      String file = (String) catalogFiles.elementAt(count);
      catalog.parseCatalog(file);
    }

    XParseError xpe = new XParseError(showErrors, showWarnings);
    xpe.setMaxMessages(maxErrs);
    reader.setErrorHandler(xpe);
View Full Code Here

      }
    } catch (SAXException e) {
      // nop;
    }

    Catalog catalog = reader.getCatalog();

    for (int count = 0; count < catalogFiles.size(); count++) {
      String file = (String) catalogFiles.elementAt(count);
      catalog.parseCatalog(file);
    }

    XParseError xpe = new XParseError(showErrors, showWarnings);
    xpe.setMaxMessages(maxErrs);
    reader.setErrorHandler(xpe);
View Full Code Here

   * Get a new catalog instance.
   *
   * This method always returns a new instance of the underlying catalog class.
   */
  public Catalog getPrivateCatalog() {
    Catalog catalog = staticCatalog;

    if (useStaticCatalog == null) {
      useStaticCatalog = new Boolean(getUseStaticCatalog());
    }

    if (catalog == null || !useStaticCatalog.booleanValue()) {

      try {
  String catalogClassName = getCatalogClassName();

  if (catalogClassName == null) {
    catalog = new Catalog();
  } else {
    try {
      catalog = (Catalog) Class.forName(catalogClassName).newInstance();
    } catch (ClassNotFoundException cnfe) {
      debug.message(1,"Catalog class named '"
        + catalogClassName
        + "' could not be found. Using default.");
      catalog = new Catalog();
    } catch (ClassCastException cnfe) {
      debug.message(1,"Class named '"
        + catalogClassName
        + "' is not a Catalog. Using default.");
      catalog = new Catalog();
    }
  }

  catalog.setCatalogManager(this);
  catalog.setupReaders();
  catalog.loadSystemCatalogs();
      } catch (Exception ex) {
  ex.printStackTrace();
      }

      if (useStaticCatalog.booleanValue()) {
View Full Code Here

   *
   * If this manager uses static catalogs, the same static catalog will
   * always be returned. Otherwise a new catalog will be returned.
   */
  public Catalog getCatalog() {
    Catalog catalog = staticCatalog;

    if (useStaticCatalog == null) {
      useStaticCatalog = new Boolean(getUseStaticCatalog());
    }

View Full Code Here

    // I could set the value explicitly, but I know that the
    // ant build file is going to set the system property, so just
    // make sure that that gets used.
    int verbosity = manager.getVerbosity();

    catalog = new Catalog(manager);
    catalog.setupReaders();
    catalog.loadSystemCatalogs();
  }
View Full Code Here

     * parsed immediately. The others will be queued and read if
     * they are needed later.
     */
    private void parseCatalogs () throws IOException {
        if (fCatalogsList != null) {
            fCatalog = new Catalog(fResolverCatalogManager);
            attachReaderToCatalog(fCatalog);
            for (int i = 0; i < fCatalogsList.length; ++i) {
                String catalog = fCatalogsList[i];
                if (catalog != null && catalog.length() > 0) {
                    fCatalog.parseCatalog(catalog);
View Full Code Here

     * parsed immediately. The others will be queued and read if
     * they are needed later.
     */
    private void parseCatalogs () throws IOException {
        if (fCatalogsList != null) {
            fCatalog = new Catalog(fResolverCatalogManager);
            attachReaderToCatalog(fCatalog);
            for (int i = 0; i < fCatalogsList.length; ++i) {
                String catalog = fCatalogsList[i];
                if (catalog != null && catalog.length() > 0) {
                    fCatalog.parseCatalog(catalog);
View Full Code Here

        return getTargetNode(resolvedLocation);
    }

    private String resolveByCatalog(String url) {
        Bus bus = (Bus)env.get(Bus.class);
        Catalog catalogResolver = OASISCatalogManager.getCatalogManager(bus).getCatalog();
        String resolvedLocation;
        try {
            resolvedLocation = catalogResolver.resolveSystem(url);
            if (resolvedLocation == null) {
                resolvedLocation = catalogResolver.resolveURI(url);
            }
        } catch (Exception e1) {
            Message msg = new Message("FAILED_RESOLVE_CATALOG", LOG, url);
            throw new ToolException(msg, e1);
        }
View Full Code Here

     * file within a <code>&lt;catalogfiles&gt;</code> fileset.
     * @param file the external catalog file.
     */
    public void parseCatalog(String file) {

        Catalog catalog = getCatalog();
        if (!(catalog instanceof ApacheCatalog)) {
            throw new BuildException("Wrong catalog type found: " + catalog.getClass().getName());
        }
        ApacheCatalog apacheCatalog = (ApacheCatalog) catalog;

        // Pass in reference to ourselves so we can be called back.
        apacheCatalog.setResolver(this);
View Full Code Here

TOP

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

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.