On this page
Interface Catalog
public interface Catalog
A catalog is an XML file that contains a root catalog
entry with a list of catalog entries. The entries can also be grouped with a group
entry. The catalog and group entries may specify prefer
and xml:base
attributes that set preference of public or system type of entries and base URI to resolve relative URIs.
A catalog can be used in two situations:
- Locate the external resources with a public or system identifier;
- Locate an alternate URI reference with a URI.
For case 1, the standard defines 6 External Identifier Entries:
public, system, rewriteSystem, systemSuffix, delegatePublic, and delegateSystem
.
While for case 2, it defines 4 URI Entries:
uri, rewriteURI, uriSuffix and delegateURI
.
In addition to the above entry types, a catalog may define nextCatalog entries to add additional catalog entry files.
- Since:
- 9
Method Summary
Modifier and Type | Method | Description |
---|---|---|
Stream<Catalog> |
catalogs() |
Returns a sequential Stream of alternative Catalogs specified using the nextCatalog entries in the current catalog, and as the input of catalog files excluding the current catalog (that is, the first in the input list) when the Catalog object is created by the CatalogManager .
|
String |
matchPublic |
Attempts to find a matching entry in the catalog by publicId.
|
String |
matchSystem |
Attempts to find a matching entry in the catalog by systemId.
|
String |
matchURI |
Attempts to find a matching entry in the catalog by the uri element.
|
Method Details
matchSystem
String matchSystem(String systemId)
The method searches through the system-type entries, including system, rewriteSystem, systemSuffix, delegateSystem
, and group
entries in the current catalog in order to find a match.
Resolution follows the steps listed below:
- If a matching
system
entry exists, it is returned immediately. - If more than one
rewriteSystem
entry matches, the matching entry with the longest normalizedsystemIdStartString
value is returned. - If more than one
systemSuffix
entry matches, the matching entry with the longest normalizedsystemIdSuffix
value is returned. - If more than one
delegateSystem
entry matches, the matching entry with the longest matchingsystemIdStartString
value is returned.
- Parameters:
systemId
- the system identifier of the entity to be matched- Returns:
- a URI string if a mapping is found, or null otherwise
matchPublic
String matchPublic(String publicId)
public, delegatePublic
, and group
entries in the current catalog in order to find a match.
Refer to the description about Feature PREFER in the table Catalog Features in class CatalogFeatures
. Public entries are only considered if the prefer
is public
and system
entries are not found.
Resolution follows the steps listed below:
- If a matching
public
entry is found, it is returned immediately. - If more than one
delegatePublic
entry matches, the matching entry with the longest matchingpublicIdStartString
value is returned.
- Parameters:
publicId
- the public identifier of the entity to be matched- Returns:
- a URI string if a mapping is found, or null otherwise
- See Also:
matchURI
String matchURI(String uri)
The method searches through the uri-type entries, including uri, rewriteURI, uriSuffix, delegateURI
and group
entries in the current catalog in order to find a match.
Resolution follows the steps listed below:
- If a matching
uri
entry is found, it is returned immediately. - If more than one
rewriteURI
entry matches, the matching entry with the longest normalizeduriStartString
value is returned. - If more than one
uriSuffix
entry matches, the matching entry with the longest normalizeduriSuffix
value is returned. - If more than one
delegatePublic
entry matches, the matching entry with the longest matchinguriStartString
value is returned.
- Parameters:
uri
- the URI reference of the entity to be matched- Returns:
- a URI string if a mapping is found, or null otherwise
catalogs
Stream<Catalog> catalogs()
nextCatalog
entries in the current catalog, and as the input of catalog files excluding the current catalog (that is, the first in the input list) when the Catalog object is created by the CatalogManager
.
The order of Catalogs in the returned stream is the same as the order in which the corresponding nextCatalog
entries appear in the current catalog. The alternative catalogs from the input file list are appended to the end of the stream in the order they are entered.
- Returns:
- a sequential Stream of Catalogs
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.xml/javax/xml/catalog/Catalog.html