The XML Resolver. The resolver maps external identifiers (document type declarations and external parsed entities) and URIs found in XML documents to local resources. This implementation supports a new interface to perform redirection through RDDL documents and automated caching of resources retrieved from the web.
For most users, the principle entry points to this
API will be the Resolver
class. Programmers may also want to
take advantage of the NamespaceResolver
interface.
Resolver
ClassThe Resolver
class implements the
EntityResolver
interface (from org.xml.sax
), the
URIResolver
interface (from javax.xml.Transformer
),
and the NamespaceResolver
(described above).
Use instances of this class as the resolvers for parsers you create.
(Or construct parsers with the utility classes in the
org.xmlresolvers.tools
package which perform catalog
resolution automatically.)
NamespaceResolver
InterfaceThe NamespaceResolver
interface is an extension of the
URIResolver
interface from the JAXP Transformer package.
It provides a single method:
public Source resolveNamespace(String uri, String nature, String purpose)
Use this method in your applications (instead of the URIResolver
)
where you are attempting to find information about a namespace URI.
The intent of this method is that it returns the
Source
associated with the namespace uri
that has the specified RDDL nature
and purpose.
The XML Resolver implements catalog extension attributes that allow a user to specify the nature and purpose of a URI. It also parses RDDL (1.0) documents.
Applications that wish to take advantage of the resolver more directly may wish to interact with the remaining classes in the API:
Catalog
implements the
OASIS XML Catalogs Standard. It loads one or more
catalog files and provides methods for searching the catalog. A successful
search returns a CatalogResult
.ResourceResolver
provides direct access to resources from the catalog.
Where the methods in the Resolver
always returns a
Source
or InputSource
, the methods in the
ResourceResolver
return Resource
s.
A Resource
represents a web resource, it has a URI, a MIME
content type, and a body.ResourceCache
performs automatic caching of resources.
It is used automatically by the Catalog
and
ResourceResolver
(and Resolver
) classes when
caching is enabled by the catalog.