gnu.xml.util
Class Resolver
- Cloneable, EntityResolver
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.
Resolver(Dictionary<K,V> dict) - Constructs a resolver which understands how to map PUBLIC identifiers
to other URIs, typically for local copies of standard DTD components.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Resolver
public Resolver(Dictionary<K,V> dict)
Constructs a resolver which understands how to map PUBLIC identifiers
to other URIs, typically for local copies of standard DTD components.
dict
- maps PUBLIC identifiers to URIs. This is not
copied; subsequent modifications will be reported through the
resolution operations.
addDirectoryMapping
public static void addDirectoryMapping(Dictionary<K,V> table,
mappings[][] ,
File directory)
throws IOException
Updates a dictionary used to map PUBLIC identifiers to file names,
so that it uses the mappings in a specified directory.
directory
- File holding the specified files.
fileNameToURL
public static String fileNameToURL(String filename)
throws IOException
Provides the URL for a named file, without relying on the JDK 1.2
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).
fileToURL
public static String fileToURL(File f)
throws IOException
Provides the URL for a file, without relying on the JDK 1.2
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).
getEncoding
public static String getEncoding(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.
contentType
- the MIME content type that will be parsed; must
not be null.
- the appropriate encoding, or null if the content type is
not text and there's no
charset=...
attribute
getURL
public static String getURL(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.
fileOrURL
- If this is the name of a file which exists,
then its URL is returned. Otherwise the argument is returned.
Resolver.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.