Skip to main content
Skip table of contents

Customized Catalog Resolver

Introduction

Those DeltaXML products that provide catalog support use a customized variant of the Apache XML Commons OASIS resolver; specifically, we customize version 1.2 of the Apache resolver. These customizations are broadly classified into three groups:

  • The bug encountered by DeltaXML's usage of the Apache Commons API has been fixed.  (https://issues.apache.org/jira/browse/XMLCOMMONS-28)

  • Fixes to minor 'features' identified during the Apache Commons integration.

  • Enhancements, mainly to support the use of 'in-built' catalogs when in application server environments.

Patches

Patch 1 - Apply fix to XMLCOMMONS-28

Resolver generates an incorrect base URL when user.dir is "/": This bug is resolved in accordance with Drew Wills's contribution.

Implementation Details: The FileURL class in the org.apache.xml.resolver.helpers package has been updated appropriately.

Patch 2 - Enable statically determinable linking

Explicit instantiation of Xerces parser: We have a requirement to enable statically determinable linking for some versions of our products, as this enables the IKVM technology to be used to cross-compile a product to .NET framework. A side-effect of this change is that it introduces a circular dependancy between the Catalog resolver and the Xerces SAX parser.

Implementation details: A straightforward change to the Catalog class's instantiation of the XML parser.

Patch 3 - Internal JAR resource loading

Resource loading catalog support: We have provided a mechanism for catalogs to load entries using Java's resource loading mechanism. The provided default implementation looks for a catalog identifier of the form jar:file:_internal-jar_._rsc_!/my_catalog_entry_id, where my_catalog_entry_id is the identity of the entry to resolve using Java's resource loading mechanism. It attempts to load the resource using the context class loader's getResourceAsStream(name) method, from the current thread of execution.

Implementation Details: We have added a UrlResourceHandler interface to the org.apache.xml.resolver.helpers package, which has a single method for opening a URL as an InputStream; i.e. the openStream(URL url) method. In addition, we needed to update the:

  • CatalogManager and Catalog classes in the  org.apache.xml.resolver package so that they can get, set and use the UrlResourceHandlers; and

  • CatalogResolver, ResolvingXMLFilter, and ResolvingParser in the org.apache.xml.resolver.tools package, so that each call to open a URL stream was sent via the new UrlResourceHandler.

  • CatalogManager and Catalog classes in the  org.apache.xml.resolver package so that they can get, set and use the UrlResourceHandlers; and

  • CatalogResolver, ResolvingXMLFilter, and ResolvingParser in the org.apache.xml.resolver.tools package, so that each call to open a URL stream was sent via the new UrlResourceHandler.

Ensure verbosity setting is used: The xml.verbosity system property is not used when constructing a catalog via a default instantiation of the CatalogResolver in the org.apache.xml.resolver.tools package. When debugging this feature, we discovered that explicitly getting the visibility setting before the catalog is fetched fixes the problem in this case. This hack has been applied.

Implementation details: Add the statement catalogManager.getVerbosity(); as the first statement in the initializeCatalogs(boolean privateCatalog) method of the CatalogResolver in the org.apache.xml.resolver.tools package.

Patch 4 - Catalog with Fixed Slashes

Slash tolerant catalogs: We have provided an alternative catalog resolver that handles both Unix style and DOS/Windows style paths in a catalog.

Implementation Details: We have added a CatalogFixSlashes class to the org.apache.xml.resolver package. It is a simple extension of the Apache's Catalog, which by default is configured to handle both Unix style and DOS/Windows style paths in a catalog.

Patch 5 - Adding bypass JAXP mechanism

Added support for providing a JAXP bypass option, by issuing the following command: helpers.Platform.setBypassJAXP(true);

Note all calls to javax.xml.parsers.SAXParserFactory.newInstance() and javax.xml.parsers.DocumentBuilderFactory.newInstance() have now been replaced by Platform.getSAXParserFactory() and Platform.getDocumentBuilderFactory() respectively.

The Patch 2 update to the Catalog class has now been superseded by this update.

Patch 6 - Correcting absolute path recognition

When attempting to load a sub-catalog whose URI is of the form file:C:path the URL searched for was of the form basepath/file:C:path. This has been fixed by converting the catalog URIs of the form file:C:path to file:/C:path.

Patch 7- Fix Windows file path issue

When creating URI from file path - now use File.toURI() function. Previously the 'file:' URI scheme prefix was added with bespoke code that would not have performed URI character encoding.

Source Code

The source code is available through our Bitbucket repository. Both the original Apache commons resolver and our modifications use version 2 of the Apache License.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.