com.calitha.xml
Class CachingURLResolver

java.lang.Object
  extended by com.calitha.xml.CachingURLResolver
All Implemented Interfaces:
URIResolver, EntityResolver

public final class CachingURLResolver
extends Object
implements EntityResolver, URIResolver

This resolver can be used to resolve requests for schemas and other resources.

These resources are loaded using the systemid and cached in a URLContentCache.

Example for using this class:

 DOMParser parser = new DOMParser();
 parser.setEntityResolver(new CachingSchemaResolver());
 

Author:
Robert van Loenhout

Constructor Summary
CachingURLResolver()
          Creates a new CachingURLResolver.
 
Method Summary
 Source resolve(String href, String base)
           
 InputSource resolveEntity(String publicId, String systemId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingURLResolver

public CachingURLResolver()
Creates a new CachingURLResolver.

It does not matter whether you use the same resolver multiple times or keep creating new resolvers, since the same global cache is used.

Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws IOException
Specified by:
resolveEntity in interface EntityResolver
Throws:
IOException

resolve

public Source resolve(String href,
                      String base)
               throws TransformerException
Specified by:
resolve in interface URIResolver
Throws:
TransformerException