跳到主要内容

JEP 268: XML Catalogs

Summary

Develop a standard XML Catalog API that supports the OASIS XML Catalogs standard, v1.1. The API will define catalog and catalog-resolver abstractions which can be used with the JAXP processors that accept resolvers.

Non-Goals

It is not intended that the new API replicate the existing internal catalog implementation. In other words, there is no intent to provide compatible APIs or maintain source or binary compatibility. Existing libraries or applications that use the internal API will need to migrate to the new API in order to take advantage of the new features.

Motivation

XML Catalogs are useful when resolving external references in XML/XSD/XSL, removing the need to repetitively retrieve external resources. In some cases, an XML Catalog is required to ensure that applications work properly in local environments where the source of the imported XML resource is different from the original.

XML Catalogs can also improve application security by directing remote external references to a local Catalog and then forbidding the retrieval of external resources.

An internal catalog resolver has been included in the JDK since JDK 6. Due to the lack of a public API, it has been used or referenced directly by external libraries/applications. It was also bundled and delivered in a Maven repository and used by applications such as JAX-WS/JAXB (see, e.g., com.sun.xml.ws.util.xml.XmlUtil). A standard API is desirable so that the feature can actually be supported.

Description

The XML Catalog API will define the following interfaces in accordance with the OASIS XML Catalogs standard, v1.1. It will provide straightforward support for the core features of the Catalog standard, implementing the EntityResolver and URIResolver interfaces:

  • The CatalogManager will manage the creation of XML Catalogs and CatalogResolvers, as well as features and properties.

  • A Catalog will implement the semantics of OASIS Open Catalog files. It will define an entity catalog that maps external identifiers and URI references to (other) URI references, and delegates to other catalogs.

  • A CatalogResolver will implement JAXP's existing EntityResolver and URIResolver interfaces. The resolver will supports the OASIS standard processing instruction as a SAX XMLFilter.

This JEP also proposes to remove the internal catalog resolver implementation after the public API is delivered.

The new API will conform to the current specification version 1.1, which is compatible with OASIS Technical Resolution 9401:1997 (Amendment 2 to TR 9401), which is what the internal catalog resolver was based on.