Skip to content

Latest commit

 

History

History
75 lines (59 loc) · 2.7 KB

README.md

File metadata and controls

75 lines (59 loc) · 2.7 KB

Migration from the Apache Commons Resolver to XMLResolver

One of the first things I remember working on at Sun Microsystems was an XML catalog resolver. It was distributed through Java.net in the dim dark past and as part of the Apache xml-commons project sometime after that. It’s rather long in the tooth these days and uses some design patterns I wouldn’t now recommend.

The xmlresolver project is a reimplementation of the catalog resolver in a more modern design and with some new features, including the ability to automatically cache resources.

This repository is a response to issue #30 in the xmlresolver repository which asks “how do I migrate from the old resolver to the new one?”

I’m pleased to say, it’s straightforward.

Using the class names

If you’re using the resolver by passing the name of the class as a system property or as an argument to another application (-x, -y, or -r to Saxon, -URIRESOLVER to Xalan, etc.), just use the new class name:

Instead of Use
org.apache.xml.resolver.tools.ResolvingXMLReader org.xmlresolver.tools.ResolvingXMLReader
org.apache.xml.resolver.tools.CatalogResolver org.xmlresolver.Resolver

In your own application

This repository has two example applications that do the same thing. The application in the apache directory uses the old Apache Commons resolver. The application in the xmlresolver directory uses the new XML Resolver library.

The differences are small. As with the class names, for a simple application, the difference is just

import org.xmlresolver.tools.ResolvingXMLReader;

instead of

import org.apache.xml.resolver.tools.ResolvingXMLReader;

If you have an application that uses the old library in a different way, and you can’t figure out how to convert it, open an issue here with a small sample that demonstrates how you’re using the old library. I’ll see if I can’t make another example application that shows the before-and-after implementations.

Configuration

There are slight differences in how the libraries are configured. The XML Resolver is backwards compatible with the old resolver, but you may wish to read the description of the new resolver and migrate your CatalogManager.properties file to XMLResolver.properties.