public void addEntry(CatalogEntry entry) {
    int type = entry.getEntryType();

    if (type == BASE) {
      String value = entry.getEntryArg(0);
      URL newbase = null;

      catalogManager.debug.message(5, "BASE CUR", base.toString());
      catalogManager.debug.message(4, "BASE STR", value);

      try {
	value = fixSlashes(value);
	newbase = new URL(base, value);
      } catch (MalformedURLException e) {
	try {
	  newbase = new URL("file:" + value);
	} catch (MalformedURLException e2) {
	  catalogManager.debug.message(1, "Malformed URL on base", value);
	  newbase = null;
	}
      }

      if (newbase != null) {
	base = newbase;
      }

      catalogManager.debug.message(5, "BASE NEW", base.toString());
    } else if (type == CATALOG) {
      String fsi = makeAbsolute(entry.getEntryArg(0));

      catalogManager.debug.message(4, "CATALOG", fsi);

      localCatalogFiles.addElement(fsi);
    } else if (type == PUBLIC) {
      String publicid = PublicId.normalize(entry.getEntryArg(0));
      String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(0, publicid);
      entry.setEntryArg(1, systemid);

      catalogManager.debug.message(4, "PUBLIC", publicid, systemid);

      catalogEntries.addElement(entry);
    } else if (type == SYSTEM) {
      String systemid = normalizeURI(entry.getEntryArg(0));
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "SYSTEM", systemid, fsi);

      catalogEntries.addElement(entry);
    } else if (type == URI) {
      String uri = normalizeURI(entry.getEntryArg(0));
      String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(1, altURI);

      catalogManager.debug.message(4, "URI", uri, altURI);

      catalogEntries.addElement(entry);
    } else if (type == DOCUMENT) {
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
      entry.setEntryArg(0, fsi);

      catalogManager.debug.message(4, "DOCUMENT", fsi);

      catalogEntries.addElement(entry);
    } else if (type == OVERRIDE) {
      catalogManager.debug.message(4, "OVERRIDE", entry.getEntryArg(0));

      catalogEntries.addElement(entry);
    } else if (type == SGMLDECL) {
      // meaningless in XML
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
      entry.setEntryArg(0, fsi);

      catalogManager.debug.message(4, "SGMLDECL", fsi);

      catalogEntries.addElement(entry);
    } else if (type == DELEGATE_PUBLIC) {
      String ppi = PublicId.normalize(entry.getEntryArg(0));
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(0, ppi);
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "DELEGATE_PUBLIC", ppi, fsi);

      addDelegate(entry);
    } else if (type == DELEGATE_SYSTEM) {
      String psi = normalizeURI(entry.getEntryArg(0));
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(0, psi);
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "DELEGATE_SYSTEM", psi, fsi);

      addDelegate(entry);
    } else if (type == DELEGATE_URI) {
      String pui = normalizeURI(entry.getEntryArg(0));
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(0, pui);
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "DELEGATE_URI", pui, fsi);

      addDelegate(entry);
    } else if (type == REWRITE_SYSTEM) {
      String psi = normalizeURI(entry.getEntryArg(0));
      String rpx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(0, psi);
      entry.setEntryArg(1, rpx);

      catalogManager.debug.message(4, "REWRITE_SYSTEM", psi, rpx);

      catalogEntries.addElement(entry);
    } else if (type == REWRITE_URI) {
      String pui = normalizeURI(entry.getEntryArg(0));
      String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));

      entry.setEntryArg(0, pui);
      entry.setEntryArg(1, upx);

      catalogManager.debug.message(4, "REWRITE_URI", pui, upx);

      catalogEntries.addElement(entry);
    } else if (type == DOCTYPE) {
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "DOCTYPE", entry.getEntryArg(0), fsi);

      catalogEntries.addElement(entry);
    } else if (type == DTDDECL) {
      // meaningless in XML
      String fpi = PublicId.normalize(entry.getEntryArg(0));
      entry.setEntryArg(0, fpi);
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "DTDDECL", fpi, fsi);

      catalogEntries.addElement(entry);
    } else if (type == ENTITY) {
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "ENTITY", entry.getEntryArg(0), fsi);

      catalogEntries.addElement(entry);
    } else if (type == LINKTYPE) {
      // meaningless in XML
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "LINKTYPE", entry.getEntryArg(0), fsi);

      catalogEntries.addElement(entry);
    } else if (type == NOTATION) {
      String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
      entry.setEntryArg(1, fsi);

      catalogManager.debug.message(4, "NOTATION", entry.getEntryArg(0), fsi);

      catalogEntries.addElement(entry);
    } else {
      catalogEntries.addElement(entry);
    }
  }
public void addEntry ( CatalogEntry entry ) { int type = entry . getEntryType ( ) ; if ( type == BASE ) { String value = entry . getEntryArg ( 0 ) ; URL newbase = null ; catalogManager . debug . message ( 5 , "BASE CUR" , base . toString ( ) ) ; catalogManager . debug . message ( 4 , "BASE STR" , value ) ; try { value = fixSlashes ( value ) ; newbase = new URL ( base , value ) ; } catch ( MalformedURLException e ) { try { newbase = new URL ( "file:" + value ) ; } catch ( MalformedURLException e2 ) { catalogManager . debug . message ( 1 , "Malformed URL on base" , value ) ; newbase = null ; } } if ( newbase != null ) { base = newbase ; } catalogManager . debug . message ( 5 , "BASE NEW" , base . toString ( ) ) ; } else if ( type == CATALOG ) { String fsi = makeAbsolute ( entry . getEntryArg ( 0 ) ) ; catalogManager . debug . message ( 4 , "CATALOG" , fsi ) ; localCatalogFiles . addElement ( fsi ) ; } else if ( type == PUBLIC ) { String publicid = PublicId . normalize ( entry . getEntryArg ( 0 ) ) ; String systemid = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 0 , publicid ) ; entry . setEntryArg ( 1 , systemid ) ; catalogManager . debug . message ( 4 , "PUBLIC" , publicid , systemid ) ; catalogEntries . addElement ( entry ) ; } else if ( type == SYSTEM ) { String systemid = normalizeURI ( entry . getEntryArg ( 0 ) ) ; String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "SYSTEM" , systemid , fsi ) ; catalogEntries . addElement ( entry ) ; } else if ( type == URI ) { String uri = normalizeURI ( entry . getEntryArg ( 0 ) ) ; String altURI = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 1 , altURI ) ; catalogManager . debug . message ( 4 , "URI" , uri , altURI ) ; catalogEntries . addElement ( entry ) ; } else if ( type == DOCUMENT ) { String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 0 ) ) ) ; entry . setEntryArg ( 0 , fsi ) ; catalogManager . debug . message ( 4 , "DOCUMENT" , fsi ) ; catalogEntries . addElement ( entry ) ; } else if ( type == OVERRIDE ) { catalogManager . debug . message ( 4 , "OVERRIDE" , entry . getEntryArg ( 0 ) ) ; catalogEntries . addElement ( entry ) ; } else if ( type == SGMLDECL ) { String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 0 ) ) ) ; entry . setEntryArg ( 0 , fsi ) ; catalogManager . debug . message ( 4 , "SGMLDECL" , fsi ) ; catalogEntries . addElement ( entry ) ; } else if ( type == DELEGATE_PUBLIC ) { String ppi = PublicId . normalize ( entry . getEntryArg ( 0 ) ) ; String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 0 , ppi ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "DELEGATE_PUBLIC" , ppi , fsi ) ; addDelegate ( entry ) ; } else if ( type == DELEGATE_SYSTEM ) { String psi = normalizeURI ( entry . getEntryArg ( 0 ) ) ; String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 0 , psi ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "DELEGATE_SYSTEM" , psi , fsi ) ; addDelegate ( entry ) ; } else if ( type == DELEGATE_URI ) { String pui = normalizeURI ( entry . getEntryArg ( 0 ) ) ; String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 0 , pui ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "DELEGATE_URI" , pui , fsi ) ; addDelegate ( entry ) ; } else if ( type == REWRITE_SYSTEM ) { String psi = normalizeURI ( entry . getEntryArg ( 0 ) ) ; String rpx = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 0 , psi ) ; entry . setEntryArg ( 1 , rpx ) ; catalogManager . debug . message ( 4 , "REWRITE_SYSTEM" , psi , rpx ) ; catalogEntries . addElement ( entry ) ; } else if ( type == REWRITE_URI ) { String pui = normalizeURI ( entry . getEntryArg ( 0 ) ) ; String upx = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 0 , pui ) ; entry . setEntryArg ( 1 , upx ) ; catalogManager . debug . message ( 4 , "REWRITE_URI" , pui , upx ) ; catalogEntries . addElement ( entry ) ; } else if ( type == DOCTYPE ) { String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "DOCTYPE" , entry . getEntryArg ( 0 ) , fsi ) ; catalogEntries . addElement ( entry ) ; } else if ( type == DTDDECL ) { String fpi = PublicId . normalize ( entry . getEntryArg ( 0 ) ) ; entry . setEntryArg ( 0 , fpi ) ; String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "DTDDECL" , fpi , fsi ) ; catalogEntries . addElement ( entry ) ; } else if ( type == ENTITY ) { String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "ENTITY" , entry . getEntryArg ( 0 ) , fsi ) ; catalogEntries . addElement ( entry ) ; } else if ( type == LINKTYPE ) { String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "LINKTYPE" , entry . getEntryArg ( 0 ) , fsi ) ; catalogEntries . addElement ( entry ) ; } else if ( type == NOTATION ) { String fsi = makeAbsolute ( normalizeURI ( entry . getEntryArg ( 1 ) ) ) ; entry . setEntryArg ( 1 , fsi ) ; catalogManager . debug . message ( 4 , "NOTATION" , entry . getEntryArg ( 0 ) , fsi ) ; catalogEntries . addElement ( entry ) ; } else { catalogEntries . addElement ( entry ) ; } }
Cleanup and process a Catalog entry.

<p>This method processes each Catalog entry, changing mapped
relative system identifiers into absolute ones (based on the current
base URI), and maintaining other information about the current
catalog.</p>

@param entry The CatalogEntry to process.