Feature | Description | Property Name | System Property [1] | Value [2] | Action | |
---|---|---|---|---|---|---|
Type | Value | |||||
FILES | A semicolon-delimited list of URIs to locate the catalog files. The URIs must be absolute and have a URL protocol handler for the URI scheme. | javax.xml.catalog.files | javax.xml.catalog.files | String | URIs | Reads the first catalog as the current catalog; Loads others if no match is found in the current catalog including delegate catalogs if any. |
PREFER | Indicates the preference between the public and system identifiers. The default value is public [3]. | javax.xml.catalog.prefer | N/A | String | system |
Searches system entries for a match; Searches public entries when external identifier specifies only a public identifier |
public |
Searches system entries for a match; Searches public entries when there is no matching system entry. | |||||
DEFER | Indicates that the alternative catalogs including those specified in delegate entries or nextCatalog are not read until they are needed. The default value is true. | javax.xml.catalog.defer [4] | javax.xml.catalog.defer | String | true |
Loads alternative catalogs as needed. |
false |
Loads all catalogs[5]. | |||||
RESOLVE | Determines the action if there is no matching entry found after all of the specified catalogs are exhausted. The default is strict. | javax.xml.catalog.resolve [4] | javax.xml.catalog.resolve | String | strict |
Throws CatalogException if there is no match. |
continue |
Allows the XML parser to continue as if there is no match. | |||||
ignore |
Tells the XML parser to skip the external references if there no match. |
[1] There is no System property for the features that marked as "N/A".
[2] The value shall be exactly as listed in this table, case-sensitive.
Any unspecified value will result in IllegalArgumentException
.
[3] The Catalog specification defined complex rules on the prefer attribute. Although the prefer can be public or system, the specification actually made system the preferred option, that is, no matter the option, a system entry is always used if found. Public entries are only considered if the prefer is public and system entries are not found. It is therefore recommended that the prefer attribute be set as public (which is the default).
[4] Although non-standard attributes in the OASIS Catalog specification,
defer
and resolve
are recognized by the Java Catalog API the
same as the prefer
as being an attribute in the catalog entry of the
main catalog. Note that only the attributes specified for the catalog entry
of the main Catalog file will be used.
[5] If the intention is to share an entire catalog store, it may be desirable to
set the property javax.xml.catalog.defer
to false to allow the entire
catalog to be pre-loaded.
prefer
attribute is set in the catalog file as in
<catalog prefer="public">
, any other input for the "prefer" property
is not necessary or will be ignored.
A CatalogFeatures instance can be created through its builder as illustrated in the following sample code:
CatalogFeatures f = CatalogFeatures.builder()
.with(Feature.FILES, "file:///etc/xml/catalog")
.with(Feature.PREFER, "public")
.with(Feature.DEFER, "true")
.with(Feature.RESOLVE, "ignore")
.build();
javax.xml.parsers
), and StAX parsers (javax.xml.stream
),
Schema Validation (javax.xml.validation
), and XML Transformation
(javax.xml.transform
). The features described above can be set through JAXP
factories or processors that define a setProperty or setAttribute interface.
For example, the following code snippet sets a URI to a catalog file on a SAX
parser through the javax.xml.catalog.files
property:
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setFeature(XMLConstants.USE_CATALOG, true); [1]
SAXParser parser = spf.newSAXParser();
parser.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), "file:///etc/xml/catalog");
[1] Note that this statement is not required since the default value of
USE_CATALOG
is true.
The JAXP Processors' support for Catalog depends on both the
USE_CATALOG
feature and the
existence of valid Catalog file(s). A JAXP processor will use the Catalog
only when the feature is true and valid Catalog file(s) are specified through
the javax.xml.catalog.files
property. It will make no attempt to use
the Catalog if either USE_CATALOG
is set to false, or there is no Catalog file specified.
The JAXP processors will observe the default settings of the
javax.
. The processors, for example, will
report an Exception by default when no matching entry is found since the
default value of the javax.xml.catalog.resolve
property is strict.
The JAXP processors give preference to user-specified custom resolvers. If such a resolver is registered, it will be used over the CatalogResolver. If it returns null however, the processors will continue resolving with the CatalogResolver. If it returns an empty source, no attempt will be made by the CatalogResolver.
The Catalog support is available for any process in the JAXP library that supports a resolver. The following table lists all such processes.
Process | Catalog Entry Type | Example |
---|---|---|
DTDs and external entities | public, system |
The following DTD reference: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Can be resolved using the following Catalog entry: <public publicId="-//W3C//DTD XHTML 1.0 Strict//EN" uri="catalog/xhtml1-strict.dtd"/> or <systemSuffix systemIdSuffix="html1-strict.dtd" uri="catalog/xhtml1-strict.dtd"/> |
XInclude | uri |
The following XInclude element: <xi:include href="https://openjdk.org/xml/disclaimer.xml"/> can be resolved using a URI entry: <uri name="https://openjdk.org/xml/disclaimer.xml" uri="file:///pathto/local/disclaimer.xml"/> or <uriSuffix uriSuffix="disclaimer.xml" uri="file:///pathto/local/disclaimer.xml"/> |
XSD import | uri |
The following import element: <xsd:import namespace="https://openjdk.org/xsd/XSDImport_person" schemaLocation="https://openjdk.org/xsd/XSDImport_person.xsd"/> can be resolved using a URI entry: <uri name="https://openjdk.org/xsd/XSDImport_person.xsd" uri="file:///pathto/local/XSDImport_person.xsd"/> or <uriSuffix uriSuffix="XSDImport_person.xsd" uri="file:///pathto/local/XSDImport_person.xsd"/> or <uriSuffix uriSuffix="https://openjdk.org/xsd/XSDImport_person" uri="file:///pathto/local/XSDImport_person.xsd"/> |
XSD include | uri |
The following include element: <xsd:include schemaLocation="https://openjdk.org/xsd/XSDInclude_person.xsd"/> can be resolved using a URI entry: <uri name="https://openjdk.org/xsd/XSDInclude_person.xsd" uri="file:///pathto/local/XSDInclude_person.xsd"/> or <uriSuffix uriSuffix="XSDInclude_person.xsd" uri="file:///pathto/local/XSDInclude_person.xsd"/> |
XSL import and include | uri |
The following include element: <xsl:include href="https://openjdk.org/xsl/include.xsl"/> can be resolved using a URI entry: <uri name="https://openjdk.org/xsl/include.xsl" uri="file:///pathto/local/include.xsl"/> or <uriSuffix uriSuffix="include.xsl" uri="file:///pathto/local/include.xsl"/> |
XSL document function | uri |
The document in the following element: <xsl:variable name="dummy" select="document('https://openjdk.org/xsl/list.xml')"/> can be resolved using a URI entry: <uri name="https://openjdk.org/xsl/list.xml" uri="file:///pathto/local/list.xml"/> or <uriSuffix uriSuffix="list.xml" uri="file:///pathto/local/list.xml"/> |
Modifier and Type | Class and Description |
---|---|
public static class | CatalogFeatures.
The Builder class for building the CatalogFeatures object. |
public static enum | CatalogFeatures.
A Feature type as defined in the Catalog Features table. |
pack-priv static enum | CatalogFeatures.
States of the settings of a property, in the order: default value, configuration file, jaxp system properties, and jaxp api properties |
Modifier and Type | Field and Description |
---|---|
pack-priv static final String | CATALOG_DEFER
The javax.xml.catalog.defer property as described in the property table above. |
pack-priv static final String | CATALOG_FILES
The constant name of the javax.xml.catalog.files property as described in the property table above. |
pack-priv static final String | CATALOG_PREFER
The javax.xml.catalog.prefer property as described in the property table above. |
pack-priv static final String | CATALOG_RESOLVE
The javax.xml.catalog.resolve property as described in the property table above. |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
pack-priv static final String | |
private CatalogFeatures. | states
States of the settings for each property |
private String[] | values
Values of the properties |
Access | Constructor and Description |
---|---|
private | |
pack-priv | CatalogFeatures(CatalogFeatures.
the builder to build the CatalogFeatures builderConstructs a new CatalogFeatures instance with the builder. |
Modifier and Type | Method and Description |
---|---|
public static CatalogFeatures. | Returns: an instance of the builderReturns an instance of the builder for creating the CatalogFeatures object. |
public static CatalogFeatures | Returns: a default CatalogFeatures instanceReturns a CatalogFeatures instance with default settings. |
public String | Returns: the value of the featurethe type of the Catalog feature cfReturns the value of the specified feature. |
private boolean | getSystemProperty(CatalogFeatures.
the type of the property cf,the name of system property sysPropertyName)Reads from system properties, or those in jaxp.properties |
private void | |
private void | |
private void | setProperties(CatalogFeatures.
the CatalogFeatures builder builderSets properties by the Builder. |
private void | setProperty(CatalogFeatures.
the index of the property feature,the state of the property state,the value of the property value)Sets the value of a property, updates only if it shall override. |
CATALOG_DEFER | back to summary |
---|---|
pack-priv static final String CATALOG_DEFER The javax.xml.catalog.defer property as described in the property table above. |
CATALOG_FILES | back to summary |
---|---|
pack-priv static final String CATALOG_FILES The constant name of the javax.xml.catalog.files property as described in the property table above. |
CATALOG_PREFER | back to summary |
---|---|
pack-priv static final String CATALOG_PREFER The javax.xml.catalog.prefer property as described in the property table above. |
CATALOG_RESOLVE | back to summary |
---|---|
pack-priv static final String CATALOG_RESOLVE The javax.xml.catalog.resolve property as described in the property table above. |
DEFER_FALSE | back to summary |
---|---|
pack-priv static final String DEFER_FALSE |
DEFER_TRUE | back to summary |
---|---|
pack-priv static final String DEFER_TRUE |
PREFER_PUBLIC | back to summary |
---|---|
pack-priv static final String PREFER_PUBLIC |
PREFER_SYSTEM | back to summary |
---|---|
pack-priv static final String PREFER_SYSTEM |
RESOLVE_CONTINUE | back to summary |
---|---|
pack-priv static final String RESOLVE_CONTINUE |
RESOLVE_IGNORE | back to summary |
---|---|
pack-priv static final String RESOLVE_IGNORE |
RESOLVE_STRICT | back to summary |
---|---|
pack-priv static final String RESOLVE_STRICT |
states | back to summary |
---|---|
private CatalogFeatures. States of the settings for each property |
values | back to summary |
---|---|
private String[] values Values of the properties |
CatalogFeatures | back to summary |
---|---|
private CatalogFeatures() Private class constructor |
CatalogFeatures | back to summary |
---|---|
pack-priv CatalogFeatures(CatalogFeatures. Constructs a new CatalogFeatures instance with the builder.
|
builder | back to summary |
---|---|
public static CatalogFeatures. Returns an instance of the builder for creating the CatalogFeatures object.
|
defaults | back to summary |
---|---|
public static CatalogFeatures defaults() Returns a CatalogFeatures instance with default settings.
|
get | back to summary |
---|---|
public String get(CatalogFeatures. Returns the value of the specified feature.
|
getSystemProperty | back to summary |
---|---|
private boolean getSystemProperty(CatalogFeatures. Reads from system properties, or those in jaxp.properties
|
init | back to summary |
---|---|
private void init() Initializes the supported properties |
readSystemProperties | back to summary |
---|---|
private void readSystemProperties() Reads from system properties, or those in jaxp.properties |
setProperties | back to summary |
---|---|
private void setProperties(CatalogFeatures. Sets properties by the Builder.
|
setProperty | back to summary |
---|---|
private void setProperty(CatalogFeatures. Sets the value of a property, updates only if it shall override.
|
Modifier and Type | Field and Description |
---|---|
pack-priv Map | values
Values of the features supported by CatalogFeatures. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public CatalogFeatures | Returns: an instance of CatalogFeaturesReturns a CatalogFeatures object built by this builder. |
public CatalogFeatures. | Returns: this Builder instancethe Feature to be set feature,the value to be set for the Feature value)Sets the value to a specified Feature. |
values | back to summary |
---|---|
pack-priv Map<CatalogFeatures. Values of the features supported by CatalogFeatures. |
Builder | back to summary |
---|---|
private Builder() Instantiation of Builder is not allowed. |
build | back to summary |
---|---|
public CatalogFeatures build() Returns a CatalogFeatures object built by this builder.
|
with | back to summary |
---|---|
public CatalogFeatures. Sets the value to a specified Feature.
|
Modifier and Type | Field and Description |
---|---|
private final String | |
public static final CatalogFeatures. | |
public static final CatalogFeatures. | |
private final boolean | |
private final String | name
Hides java. |
public static final CatalogFeatures. | |
public static final CatalogFeatures. | |
private String |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public String | |
pack-priv boolean | Returns: true if the specified property is the current property, false otherwisethe name of a property propertyName)Checks whether the specified property is equal to the current property. |
public String | Returns: the name of the System PropertyReturns the name of the corresponding System Property. |
pack-priv String | |
pack-priv boolean | Returns: true it is supported, false otherwiseChecks whether System property is supported for the feature. |
public static CatalogFeatures. | |
public static CatalogFeatures. |
defaultValue | back to summary |
---|---|
private final String defaultValue |
DEFER | back to summary |
---|---|
public static final CatalogFeatures. The |
FILES | back to summary |
---|---|
public static final CatalogFeatures. The |
hasSystem | back to summary |
---|---|
private final boolean hasSystem |
name | back to summary |
---|---|
private final String name Hides java. |
PREFER | back to summary |
---|---|
public static final CatalogFeatures. The |
RESOLVE | back to summary |
---|---|
public static final CatalogFeatures. The |
value | back to summary |
---|---|
private String value |
Feature | back to summary |
---|---|
private Feature(String name, String value, boolean hasSystem) Constructs a CatalogFeature instance. |
defaultValue | back to summary |
---|---|
public String defaultValue() Returns the default value of the property.
|
equalsPropertyName | back to summary |
---|---|
pack-priv boolean equalsPropertyName(String propertyName) Checks whether the specified property is equal to the current property.
|
getPropertyName | back to summary |
---|---|
public String getPropertyName() Returns the name of the corresponding System Property.
|
getValue | back to summary |
---|---|
pack-priv String getValue() Returns the value of the property.
|
hasSystemProperty | back to summary |
---|---|
pack-priv boolean hasSystemProperty() Checks whether System property is supported for the feature.
|
valueOf | back to summary |
---|---|
public static CatalogFeatures. |
values | back to summary |
---|---|
public static CatalogFeatures. |
Modifier and Type | Field and Description |
---|---|
public static final CatalogFeatures. | APIPROPERTY
indicates the value of the feature is specified through the API. |
public static final CatalogFeatures. | CATALOGATTRIBUTE
indicates the value of the feature is specified as a catalog attribute. |
public static final CatalogFeatures. | DEFAULT
represents the default state of a feature. |
public static final CatalogFeatures. | JAXPDOTPROPERTIES
indicates the value of the feature is read from jaxp.properties. |
pack-priv final String | |
public static final CatalogFeatures. | SYSTEMPROPERTY
indicates the value of the feature is read from its System property. |
Modifier and Type | Method and Description |
---|---|
pack-priv String | |
public static CatalogFeatures. | |
public static CatalogFeatures. |
APIPROPERTY | back to summary |
---|---|
public static final CatalogFeatures. indicates the value of the feature is specified through the API. |
CATALOGATTRIBUTE | back to summary |
---|---|
public static final CatalogFeatures. indicates the value of the feature is specified as a catalog attribute. |
DEFAULT | back to summary |
---|---|
public static final CatalogFeatures. represents the default state of a feature. |
JAXPDOTPROPERTIES | back to summary |
---|---|
public static final CatalogFeatures. indicates the value of the feature is read from jaxp.properties. |
literal | back to summary |
---|---|
pack-priv final String literal |
SYSTEMPROPERTY | back to summary |
---|---|
public static final CatalogFeatures. indicates the value of the feature is read from its System property. |
State | back to summary |
---|---|
private State(String literal) |
literal | back to summary |
---|---|
pack-priv String literal() |
valueOf | back to summary |
---|---|
public static CatalogFeatures. |
values | back to summary |
---|---|
public static CatalogFeatures. |