- 
- All Superinterfaces:
- EntityResolver,- LSResourceResolver,- URIResolver,- XMLResolver
 
 public interface CatalogResolver extends EntityResolver, XMLResolver, URIResolver, LSResourceResolver A Catalog Resolver that implements SAXEntityResolver, StAXXMLResolver, DOM LSLSResourceResolverused by Schema Validation, and TransformURIResolver, and resolves external references using catalogs.The Catalog Standard distinguished external identifiersfromuri entriesas being used to solely identify DTDs, whileuri entriesfor other resources such as stylesheets and schema. The Java APIs, such asXMLResolverandLSResourceResolverhowever, make no such distinction. In consistent with the existing Java API, this CatalogResolver recognizes a system identifier as a URI and will search bothsystemandurientries in a catalog in order to find a matching entry.The search is started in the current catalog. If a match is found, no further attempt will be made. Only if there is no match in the current catalog, will alternate catalogs including delegate and next catalogs be considered. Search OrderThe resolver will first search the system-type of entries with the specifiedsystemId. The system entries includesystem,rewriteSystemandsystemSuffixentries.If no match is found, publicentries may be searched in accordance with thepreferattribute.The preferattribute: if thepreferis public, and there is no match found through the system entries,publicentries will be considered. If it is not specified, thepreferis public by default (Note that by the OASIS standard, system entries will always be considered before public entries. Prefer public means that public entries will be matched when both system and public identifiers are specified. In general therefore, prefer public is recommended.)If no match is found with the systemIdandpublicidentifier, the resolver will continue searchingurientries with the specifiedsystemIdorhref. Theurientries includeuri,rewriteURI, anduriSuffixentries.Error HandlingThe interfaces that the CatalogResolver extend specified checked exceptions, including:- 
 SAXExceptionandIOExceptionbyEntityResolver.resolveEntity(java.lang.String, java.lang.String)
- 
 XMLStreamExceptionbyXMLResolver.resolveEntity(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- 
 TransformerExceptionbyURIResolver.resolve(java.lang.String, java.lang.String)
 The CatalogResolver however, will throw CatalogExceptiononly whenjavax.xml.catalog.resolveis specified asstrict. For applications that expect to handle the checked Exceptions, it may be necessary to use a custom resolver to wrap the CatalogResolver or implement it with aCatalogobject.- Since:
- 9
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description Sourceresolve(String href, String base)Implements URIResolver.InputSourceresolveEntity(String publicId, String systemId)ImplementsEntityResolver.InputStreamresolveEntity(String publicId, String systemId, String baseUri, String namespace)ImplementsXMLResolver.LSInputresolveResource(String type, String namespaceUri, String publicId, String systemId, String baseUri)ImplementsLSResourceResolver.
 
- 
- 
- 
Method Detail- 
resolveEntityInputSource resolveEntity(String publicId, String systemId) ImplementsEntityResolver. The method searches through the catalog entries in the main and alternative catalogs to attempt to find a match with the specifiedpublicIdor systemId.- Specified by:
- resolveEntityin interface- EntityResolver
- Parameters:
- publicId- the public identifier of the external entity being referenced, or null if none was supplied
- systemId- the system identifier of the external entity being referenced. A system identifier is required on all external entities. XML requires a system identifier on all external entities, so this value is always specified.
- Returns:
- a InputSourceobject if a mapping is found. If no mapping is found, returns aInputSourceobject containing an emptyReaderif thejavax.xml.catalog.resolveproperty is set toignore; returns null if thejavax.xml.catalog.resolveproperty is set tocontinue.
- Throws:
- CatalogException- if no mapping is found and- javax.xml.catalog.resolveis specified as- strict
- See Also:
- InputSource
 
 - 
resolveSource resolve(String href, String base) Implements URIResolver. The method searches through the catalog entries in the main and alternative catalogs to attempt to find a match with the specifiedhrefattribute. Thehrefattribute will be used literally, with no attempt to be made absolute to thebase.If the value is a URN, the hrefattribute is recognized as apublicId, and used to searchpublicentries. If the value is a URI, it is taken as asystemId, and used to search bothsystemandurientries.- Specified by:
- resolvein interface- URIResolver
- Parameters:
- href- the href attribute that specifies the URI of a style sheet, which may be relative or absolute
- base- The base URI against which the href attribute will be made absolute if the absolute URI is required
- Returns:
- a Sourceobject if a mapping is found. If no mapping is found, returns an emptySourceobject if thejavax.xml.catalog.resolveproperty is set toignore; returns aSourceobject with the original URI (href, or href resolved with base if base is not null) if thejavax.xml.catalog.resolveproperty is set tocontinue.
- Throws:
- CatalogException- if no mapping is found and- javax.xml.catalog.resolveis specified as- strict
 
 - 
resolveEntityInputStream resolveEntity(String publicId, String systemId, String baseUri, String namespace) ImplementsXMLResolver. For the purpose of resolvingpublicIdandsystemId, this method is equivalent toresolveEntity(java.lang.String, java.lang.String).The systemIdwill be used literally, with no attempt to be made absolute to thebaseUri. ThebaseUriandnamespaceare not used in the search for a match in a catalog. However, a relativesystemIdin an xml source may have been made absolute by the parser with thebaseURI, thus making it unable to find asystementry. In such a case, asystemSuffixentry is recommended over asystementry.- Specified by:
- resolveEntityin interface- XMLResolver
- Parameters:
- publicId- the public identifier of the external entity being referenced, or null if none was supplied
- systemId- the system identifier of the external entity being referenced. A system identifier is required on all external entities. XML requires a system identifier on all external entities, so this value is always specified.
- baseUri- the absolute base URI, not used by the CatalogResolver
- namespace- the namespace of the entity to resolve, not used by the CatalogResolver.
- Returns:
- an InputStreamobject if a mapping is found; null if no mapping is found and thejavax.xml.catalog.resolveproperty is set tocontinueorignore. Note that for XMLResolver, it is not possible to ignore a reference,ignoreis therefore treated the same ascontinue.
- Throws:
- CatalogException- if no mapping is found and- javax.xml.catalog.resolveis specified as- strict
 
 - 
resolveResourceLSInput resolveResource(String type, String namespaceUri, String publicId, String systemId, String baseUri) ImplementsLSResourceResolver. For the purpose of resolvingpublicIdandsystemId, this method is equivalent toresolveEntity(java.lang.String, java.lang.String).The systemIdwill be used literally, with no attempt to be made absolute to thebaseUri. ThebaseUri,namespaceUriandtypeare not used in the search for a match in a catalog. However, a relativesystemIdin a source may have been made absolute by the parser with thebaseURI, thus making it unable to find asystementry. In such a case, asystemSuffixentry is recommended over asystementry.- Specified by:
- resolveResourcein interface- LSResourceResolver
- Parameters:
- type- the type of the resource being resolved, not used by the CatalogResolver
- namespaceUri- the namespace of the resource being resolved, not used by the CatalogResolver
- publicId- the public identifier of the external entity being referenced, or- nullif no public identifier was supplied or if the resource is not an entity.
- systemId- the system identifier, a URI reference of the external resource being referenced
- baseUri- the absolute base URI, not used by the CatalogResolver
- Returns:
- a LSInputobject if a mapping is found; null if no mapping is found and thejavax.xml.catalog.resolveproperty is set tocontinueorignore. Note that forLSResourceResolver, it is not possible to ignore a reference,ignoreis therefore treated the same ascontinue.
- Throws:
- CatalogException- if no mapping is found and- javax.xml.catalog.resolveis specified as- strict
 
 
- 
 
-