Package org.apache.xml.resolver

Examples of org.apache.xml.resolver.CatalogEntry


    /**
     * Adds a new Entry to the catalog
     */
    private void addEntry(String type, Vector args) {
        try {
            CatalogEntry entry = new CatalogEntry(type, args);
            catalog.addEntry(entry);
        } catch (CatalogException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


    /**
     * Adds a new Entry to the catalog
     */
    private void addEntry(String type, Vector args) {
        try {
            CatalogEntry entry = new CatalogEntry(type, args);
            catalog.addEntry(entry);
        } catch (CatalogException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    /**
     * Adds a new Entry to the catalog
     */
    private void addEntry(String type, Vector args) {
        try {
            CatalogEntry entry = new CatalogEntry(type, args);
            catalog.addEntry(entry);
        } catch (CatalogException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

  for (int count = 0; count < numArgs; count++) {
    args.addElement(nextToken());
  }

  catalog.addEntry(new CatalogEntry(entryToken, args));
      } catch (CatalogException cex) {
  if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
    if (unknownEntry == null) {
      unknownEntry = new Vector();
    }
View Full Code Here

  baseURIStack.push(baseURI);

  debug.message(4, "xml:base", baseURI);

  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
      debug.message(1, "Invalid catalog entry (base)", localName);
    }
  }

  entryType = -1;
  entryArgs = new Vector();
      } else {
  baseURIStack.push(baseURIStack.peek());
      }

      if (localName.equals("uriSuffix")) {
  if (checkAttributes(atts, "suffix", "uri")) {
    entryType = Resolver.URISUFFIX;
    entryArgs.add(atts.getValue("suffix"));
    entryArgs.add(atts.getValue("uri"));

    debug.message(4, "uriSuffix",
      atts.getValue("suffix"),
      atts.getValue("uri"));
  }
      } else if (localName.equals("systemSuffix")) {
  if (checkAttributes(atts, "suffix", "uri")) {
    entryType = Resolver.SYSTEMSUFFIX;
    entryArgs.add(atts.getValue("suffix"));
    entryArgs.add(atts.getValue("uri"));

    debug.message(4, "systemSuffix",
      atts.getValue("suffix"),
      atts.getValue("uri"));
  }
      } else {
  // This is equivalent to an invalid catalog entry type
  debug.message(1, "Invalid catalog entry type", localName);
      }

      if (entryType >= 0) {
  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
View Full Code Here

  entryArgs.add(baseURI);

  debug.message(4, "(reset) xml:base", baseURI);

  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
View Full Code Here

  baseURIStack.push(baseURI);

  debug.message(4, "xml:base", baseURI);

  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
      debug.message(1, "Invalid catalog entry (base)", localName);
    }
  }

  entryType = -1;
  entryArgs = new Vector();

      } else {
  baseURIStack.push(baseURIStack.peek());
      }

      if ((localName.equals("catalog") || localName.equals("group"))
    && atts.getValue("prefer") != null) {
  String override = atts.getValue("prefer");

  if (override.equals("public")) {
    override = "yes";
  } else if (override.equals("system")) {
    override = "no";
  } else {
    debug.message(1,
      "Invalid prefer: must be 'system' or 'public'",
      localName);
    override = catalog.getDefaultOverride();
  }

  entryType = Catalog.OVERRIDE;
  entryArgs.add(override);
  overrideStack.push(override);

  debug.message(4, "override", override);

  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
      debug.message(1, "Invalid catalog entry (override)", localName);
    }
  }

  entryType = -1;
  entryArgs = new Vector();

      } else {
  overrideStack.push(overrideStack.peek());
      }

      if (localName.equals("delegatePublic")) {
  if (checkAttributes(atts, "publicIdStartString", "catalog")) {
    entryType = Catalog.DELEGATE_PUBLIC;
    entryArgs.add(atts.getValue("publicIdStartString"));
    entryArgs.add(atts.getValue("catalog"));

    debug.message(4, "delegatePublic",
      PublicId.normalize(atts.getValue("publicIdStartString")),
      atts.getValue("catalog"));
  }
      } else if (localName.equals("delegateSystem")) {
  if (checkAttributes(atts, "systemIdStartString", "catalog")) {
    entryType = Catalog.DELEGATE_SYSTEM;
    entryArgs.add(atts.getValue("systemIdStartString"));
    entryArgs.add(atts.getValue("catalog"));

    debug.message(4, "delegateSystem",
      atts.getValue("systemIdStartString"),
      atts.getValue("catalog"));
  }
      } else if (localName.equals("delegateURI")) {
  if (checkAttributes(atts, "uriStartString", "catalog")) {
    entryType = Catalog.DELEGATE_URI;
    entryArgs.add(atts.getValue("uriStartString"));
    entryArgs.add(atts.getValue("catalog"));

    debug.message(4, "delegateURI",
      atts.getValue("uriStartString"),
      atts.getValue("catalog"));
  }
      } else if (localName.equals("rewriteSystem")) {
  if (checkAttributes(atts, "systemIdStartString", "rewritePrefix")) {
    entryType = Catalog.REWRITE_SYSTEM;
    entryArgs.add(atts.getValue("systemIdStartString"));
    entryArgs.add(atts.getValue("rewritePrefix"));

    debug.message(4, "rewriteSystem",
      atts.getValue("systemIdStartString"),
      atts.getValue("rewritePrefix"));
  }
      } else if (localName.equals("rewriteURI")) {
  if (checkAttributes(atts, "uriStartString", "rewritePrefix")) {
    entryType = Catalog.REWRITE_URI;
    entryArgs.add(atts.getValue("uriStartString"));
    entryArgs.add(atts.getValue("rewritePrefix"));

    debug.message(4, "rewriteURI",
      atts.getValue("uriStartString"),
      atts.getValue("rewritePrefix"));
  }
      } else if (localName.equals("nextCatalog")) {
  if (checkAttributes(atts, "catalog")) {
    entryType = Catalog.CATALOG;
    entryArgs.add(atts.getValue("catalog"));

    debug.message(4, "nextCatalog", atts.getValue("catalog"));
  }
      } else if (localName.equals("public")) {
  if (checkAttributes(atts, "publicId", "uri")) {
    entryType = Catalog.PUBLIC;
    entryArgs.add(atts.getValue("publicId"));
    entryArgs.add(atts.getValue("uri"));

    debug.message(4, "public",
      PublicId.normalize(atts.getValue("publicId")),
      atts.getValue("uri"));
  }
      } else if (localName.equals("system")) {
  if (checkAttributes(atts, "systemId", "uri")) {
    entryType = Catalog.SYSTEM;
    entryArgs.add(atts.getValue("systemId"));
    entryArgs.add(atts.getValue("uri"));

    debug.message(4, "system",
      atts.getValue("systemId"),
      atts.getValue("uri"));
  }
      } else if (localName.equals("uri")) {
  if (checkAttributes(atts, "name", "uri")) {
    entryType = Catalog.URI;
    entryArgs.add(atts.getValue("name"));
    entryArgs.add(atts.getValue("uri"));

    debug.message(4, "uri",
      atts.getValue("name"),
      atts.getValue("uri"));
  }
      } else if (localName.equals("catalog")) {
  // nop, start of catalog
      } else if (localName.equals("group")) {
  // nop, a group
      } else {
  // This is equivalent to an invalid catalog entry type
  debug.message(1, "Invalid catalog entry type", localName);
      }

      if (entryType >= 0) {
  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
      debug.message(1, "Invalid catalog entry", localName);
    }
  }
      }
    }

    if (namespaceURI != null && tr9401NamespaceName.equals(namespaceURI)
  && !inExtension) {
      // This is a TR9401 Catalog entry

      if (atts.getValue("xml:base") != null) {
  String baseURI = atts.getValue("xml:base");
  entryType = Catalog.BASE;
  entryArgs.add(baseURI);
  baseURIStack.push(baseURI);

  debug.message(4, "xml:base", baseURI);

  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
      debug.message(1, "Invalid catalog entry (base)", localName);
    }
  }

  entryType = -1;
  entryArgs = new Vector();

      } else {
  baseURIStack.push(baseURIStack.peek());
      }

      if (localName.equals("doctype")) {
  entryType = catalog.DOCTYPE;
  entryArgs.add(atts.getValue("name"));
  entryArgs.add(atts.getValue("uri"));
      } else if (localName.equals("document")) {
  entryType = catalog.DOCUMENT;
  entryArgs.add(atts.getValue("uri"));
      } else if (localName.equals("dtddecl")) {
  entryType = catalog.DTDDECL;
  entryArgs.add(atts.getValue("publicId"));
  entryArgs.add(atts.getValue("uri"));
      } else if (localName.equals("entity")) {
  entryType = Catalog.ENTITY;
  entryArgs.add(atts.getValue("name"));
  entryArgs.add(atts.getValue("uri"));
      } else if (localName.equals("linktype")) {
  entryType = Catalog.LINKTYPE;
  entryArgs.add(atts.getValue("name"));
  entryArgs.add(atts.getValue("uri"));
      } else if (localName.equals("notation")) {
  entryType = Catalog.NOTATION;
  entryArgs.add(atts.getValue("name"));
  entryArgs.add(atts.getValue("uri"));
      } else if (localName.equals("sgmldecl")) {
  entryType = Catalog.SGMLDECL;
  entryArgs.add(atts.getValue("uri"));
      } else {
  // This is equivalent to an invalid catalog entry type
  debug.message(1, "Invalid catalog entry type", localName);
      }

      if (entryType >= 0) {
  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
View Full Code Here

  entryArgs.add(baseURI);

  debug.message(4, "(reset) xml:base", baseURI);

  try {
    CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
    catalog.addEntry(ce);
  } catch (CatalogException cex) {
    if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
      debug.message(1, "Invalid catalog entry type", localName);
    } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
      debug.message(1, "Invalid catalog entry (rbase)", localName);
    }
  }
      }
    }

    if (namespaceURI != null && namespaceName.equals(namespaceURI)
  && !inExtension) {
      if (localName.equals("catalog") || localName.equals("group")) {
  String popOverride = (String) overrideStack.pop();
  String override = (String) overrideStack.peek();

  if (!override.equals(popOverride)) {
    entryType = catalog.OVERRIDE;
    entryArgs.add(override);
    overrideStack.push(override);

    debug.message(4, "(reset) override", override);

    try {
      CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
      catalog.addEntry(ce);
    } catch (CatalogException cex) {
      if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
        debug.message(1, "Invalid catalog entry type", localName);
      } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
View Full Code Here

  for (int count = 0; count < numArgs; count++) {
    args.addElement(nextToken());
  }

  catalog.addEntry(new CatalogEntry(entryToken, args));
      } catch (CatalogException cex) {
  if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
    if (unknownEntry == null) {
      unknownEntry = new Vector();
    }
View Full Code Here

      catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
    }

    if (entryType >= 0) {
      try {
  CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
  catalog.addEntry(ce);
      } catch (CatalogException cex) {
  if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
    catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
  } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
View Full Code Here

TOP

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

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.