Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
gnu.xml.util

Class Resolver

java.lang.Object
|
+--gnu.xml.util.Resolver

All Implemented Interfaces:

EntityResolver, Cloneable


public class Resolver

extends Object

implements EntityResolver, Cloneable

Utility implementation of a SAX resolver, which can be used to improve network utilization of SAX based XML components. It does this by supporting local caches of external entities. SAX parsers should use such local caches when possible.

See Also:

Constructor Summary

Resolver(java.util.Dictionary dict)

Constructs a resolver which understands how to map PUBLIC identifiers to other URIs, typically for local copies of standard DTD components.

Method Summary

static voidaddDirectoryMapping(java.util.Dictionary table, String mappings[][][][] , java.io.File directory)

Updates a dictionary used to map PUBLIC identifiers to file names, so that it uses the mappings in a specified directory.
static java.lang.StringfileNameToURL(java.lang.String filename)

Provides the URL for a named file, without relying on the JDK 1.2 java.io.File#toURL File.toURL() utility method.
static java.lang.StringfileToURL(java.io.File f)

Provides the URL for a file, without relying on the JDK 1.2 java.io.File#toURL File.toURL() utility method.
static java.lang.StringgetEncoding(java.lang.String contentType)

This parses most MIME content type strings that have charset=... encoding declarations to and returns the specified encoding.
static java.lang.StringgetURL(java.lang.String fileOrURL)

Returns a URL string.
org.xml.sax.InputSourceresolveEntity(java.lang.String publicId, java.lang.String systemId)

Uses a local dictionary of public identifiers to resolve URIs, normally with the goal of minimizing network traffic or latencies.

Constructor Details

Resolver

public Resolver(java.util.Dictionary dict)

Constructs a resolver which understands how to map PUBLIC identifiers to other URIs, typically for local copies of standard DTD components.

Parameters:


Method Details

addDirectoryMapping

public static void addDirectoryMapping(java.util.Dictionary table, String mappings[][][][] , java.io.File directory)

Updates a dictionary used to map PUBLIC identifiers to file names, so that it uses the mappings in a specified directory.

Parameters:


fileNameToURL

public static String fileNameToURL(java.lang.String filename)

Provides the URL for a named file, without relying on the JDK 1.2 java.io.File#toURL File.toURL() utility method.

Parameters:

Throws:


fileToURL

public static String fileToURL(java.io.File f)

Provides the URL for a file, without relying on the JDK 1.2 java.io.File#toURL File.toURL() utility method.

Parameters:

Throws:


getEncoding

public static String getEncoding(java.lang.String contentType)

This parses most MIME content type strings that have charset=... encoding declarations to and returns the specified encoding. This conforms to RFC 3023, and is useful when constructing InputSource objects from URLConnection objects or other objects using MIME content typing.

Parameters:

Returns:


getURL

public static String getURL(java.lang.String fileOrURL)

Returns a URL string. Note that if a malformed URL is provided, or the parameter names a nonexistent file, the resulting URL may be malformed.

Parameters:


resolveEntity

public InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)

Uses a local dictionary of public identifiers to resolve URIs, normally with the goal of minimizing network traffic or latencies.

Parameters: