|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.xml.util.Resolver
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.
FIXME: This needs to leverage a catalog facility.
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 void |
addDirectoryMapping(java.util.Dictionary table,
java.lang.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.String |
fileNameToURL(java.lang.String filename)
Provides the URL for a named file, without relying on the JDK 1.2 File.toURL () utility method. |
static java.lang.String |
fileToURL(java.io.File f)
Provides the URL for a file, without relying on the JDK 1.2 File.toURL () utility method. |
static java.lang.String |
getEncoding(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.String |
getURL(java.lang.String fileOrURL)
Returns a URL string. |
InputSource |
resolveEntity(java.lang.String pubid,
java.lang.String sysid)
Uses a local dictionary of public identifiers to resolve URIs, normally with the goal of minimizing network traffic or latencies. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Resolver(java.util.Dictionary dict)
dictionary
- maps PUBLIC identifiers to URIs. This is not
copied; subsequent modifications will be reported through the
resolution operations.Method Detail |
public static void addDirectoryMapping(java.util.Dictionary table, java.lang.String[][] mappings, java.io.File directory) throws java.io.IOException
mappings
- Array of string pairs, where the first member
of each pair is a PUBLIC identifier and the second is the
name of a file, relative to the specified directory.directory
- File holding the specified files.public static java.lang.String fileNameToURL(java.lang.String filename) throws java.io.IOException
File.toURL
() utility method.filename
- the file name to convert. Relative file names
are resolved the way the JVM resolves them (current to the
process-global current working directory).java.io.IOException
- if the file does not existpublic static java.lang.String fileToURL(java.io.File f) throws java.io.IOException
File.toURL
() utility method.f
- the file to convert. Relative file names
are resolved the way the JVM resolves them (current to the
process-global current working directory).java.io.IOException
- if the file does not existpublic static java.lang.String getURL(java.lang.String fileOrURL)
fileOrURL
- If this is the name of a file which exists,
then its URL is returned. Otherwise the argument is returned.public static java.lang.String getEncoding(java.lang.String contentType)
contentType
- the MIME content type that will be parsed; must
not be null.public InputSource resolveEntity(java.lang.String pubid, java.lang.String sysid) throws java.io.IOException, SAXException
resolveEntity
in interface EntityResolver
org.xml.sax.EntityResolver
publicId
- The public identifier of the external entity
being referenced, or null if none was supplied.systemId
- The system identifier of the external entity
being referenced.SAXException
- Any SAX exception, possibly
wrapping another exception.java.io.IOException
- A Java-specific IO exception,
possibly the result of creating a new InputStream
or Reader for the InputSource.InputSource
|
Source code is GPL'd in the JAXP subproject at http://savannah.gnu.org/projects/classpathx |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |