src/main/java/org/jboss/util/xml/catalog/Catalog.java
public String resolvePublic(String publicId, String systemId) 
    throws MalformedURLException, IOException {

    catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")");

    systemId = normalizeURI(systemId);

    if (publicId != null && publicId.startsWith("urn:publicid:")) {
      publicId = PublicId.decodeURN(publicId);
    }

    if (systemId != null && systemId.startsWith("urn:publicid:")) {
      systemId = PublicId.decodeURN(systemId);
      if (publicId != null && !publicId.equals(systemId)) {
	catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
	systemId = null;
      } else {
	publicId = systemId;
	systemId = null;
      }
    }

    // If there's a SYSTEM entry in this catalog, use it
    if (systemId != null) {
      String resolved = resolveLocalSystem(systemId);
      if (resolved != null) {
	return resolved;
      }
    }

    // If there's a PUBLIC entry in this catalog, use it
    String resolved = resolveLocalPublic(PUBLIC,
					 null,
					 publicId,
					 systemId);
    if (resolved != null) {
      return resolved;
    }

    // Otherwise, look in the subordinate catalogs
    return resolveSubordinateCatalogs(PUBLIC,
				      null,
				      publicId,
				      systemId);
  }
public String resolvePublic(String publicId, String systemId) 
    throws MalformedURLException, IOException {

    catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")");

    systemId = normalizeURI(systemId);

    if (publicId != null && publicId.startsWith("urn:publicid:")) {
      publicId = PublicId.decodeURN(publicId);
    }

    if (systemId != null && systemId.startsWith("urn:publicid:")) {
      systemId = PublicId.decodeURN(systemId);
      if (publicId != null && !publicId.equals(systemId)) {
	catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
	systemId = null;
      } else {
	publicId = systemId;
	systemId = null;
      }
    }

    // If there's a SYSTEM entry in this catalog, use it
    if (systemId != null) {
      String resolved = resolveLocalSystem(systemId);
      if (resolved != null) {
	return resolved;
      }
    }

    // If there's a PUBLIC entry in this catalog, use it
    String resolved = resolveLocalPublic(PUBLIC,
					 null,
					 publicId,
					 systemId);
    if (resolved != null) {
      return resolved;
    }

    // Otherwise, look in the subordinate catalogs
    return resolveSubordinateCatalogs(PUBLIC,
				      null,
				      publicId,
				      systemId);
  }
public String resolvePublic ( String publicId , String systemId ) throws MalformedURLException , IOException { catalogManager . debug . message ( 3 , "resolvePublic(" + publicId + "," + systemId + ")" ) ; systemId = normalizeURI ( systemId ) ; if ( publicId != null && publicId . startsWith ( "urn:publicid:" ) ) { publicId = PublicId . decodeURN ( publicId ) ; } if ( systemId != null && systemId . startsWith ( "urn:publicid:" ) ) { systemId = PublicId . decodeURN ( systemId ) ; if ( publicId != null && ! publicId . equals ( systemId ) ) { catalogManager . debug . message ( 1 , "urn:publicid: system identifier differs from public identifier; using public identifier" ) ; systemId = null ; } else { publicId = systemId ; systemId = null ; } } // If there's a SYSTEM entry in this catalog, use it if ( systemId != null ) { String resolved = resolveLocalSystem ( systemId ) ; if ( resolved != null ) { return resolved ; } } // If there's a PUBLIC entry in this catalog, use it String resolved = resolveLocalPublic ( PUBLIC , null , publicId , systemId ) ; if ( resolved != null ) { return resolved ; } // Otherwise, look in the subordinate catalogs return resolveSubordinateCatalogs ( PUBLIC , null , publicId , systemId ) ; }
Return the applicable PUBLIC or SYSTEM identifier.

<p>This method searches the Catalog and returns the system
identifier specified for the given system or
public identifiers. If
no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
null is returned.</p>

@param publicId The public identifier to locate in the catalog.
Public identifiers are normalized before comparison.
@param systemId The nominal system identifier for the entity
in question (as provided in the source document).

@throws MalformedURLException The formal system identifier of a
subordinate catalog cannot be turned into a valid URL.
@throws IOException Error reading subordinate catalog file.

@return The system identifier to use.
Note that the nominal system identifier is not returned if a
match is not found in the catalog, instead null is returned
to indicate that no match was found.
Return the applicable PUBLIC or SYSTEM identifier .