xml
Class Resolver

java.lang.Object
  extended by xml.Resolver
All Implemented Interfaces:
org.w3c.dom.ls.LSResourceResolver, org.xml.sax.EntityResolver, org.xml.sax.ext.EntityResolver2

public class Resolver
extends java.lang.Object
implements org.xml.sax.ext.EntityResolver2, org.w3c.dom.ls.LSResourceResolver

Resolver grabs and caches DTDs and xml schemas. It also serves as a resource resolver for jeditresource: links

Version:
$Id: Resolver.java 21316 2012-03-11 10:33:42Z kerik-sf $
Author:
ezust, kerik-sf

Nested Class Summary
static class Resolver.Entry
           
 class Resolver.VFSUpdateHandler
          Reloads all catalog files when the user changes one of it on disk.
 
Field Summary
static java.lang.String ALWAYS
          Download without asking
static java.lang.String ASK
          Ask before downloading
static java.lang.String CACHE
          Cache downloaded remote files
static java.lang.String INTERNALCATALOG
          Internal catalog for DTDs which are packaged in XML.jar and jEdit.jar
static java.lang.String LOCAL
          Local files & catalogs only
static java.lang.String MODE
          Ask before downloading remote files
static java.lang.String[] MODES
           
static java.lang.String NETWORK_PROPS
           
 
Method Summary
 void clearCache()
           
 org.xml.sax.InputSource getExternalSubset(java.lang.String name, java.lang.String baseURI)
           
static java.lang.String getNetworkMode()
           
static Resolver instance()
           
static boolean isUsingCache()
           
 void propertiesChanged()
           
 void reloadCatalogs()
          called from actions.xml
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          implements SAX1 EntityResolver
 org.xml.sax.InputSource resolveEntity(java.lang.String name, java.lang.String publicId, java.lang.String current, java.lang.String systemId)
           
 java.lang.String resolveEntityToPath(java.lang.String name, java.lang.String publicId, java.lang.String current, java.lang.String systemId)
           
 java.lang.String[] resolveEntityToPathInternal(java.lang.String name, java.lang.String publicId, java.lang.String current, java.lang.String systemId)
          systemId may be modified, for instance if resolving docbookx.dtd, the systemId will be the full jeditresource:XML.jar!.../docbookx.dtd
 org.w3c.dom.ls.LSInput resolveResource(java.lang.String type, java.lang.String namespaceURI, java.lang.String publicId, java.lang.String systemId, java.lang.String baseURI)
           
 void save()
           
static void setNetworkMode(java.lang.String newMode)
           
static void setUsingCache(boolean newCache)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASK

public static final java.lang.String ASK
Ask before downloading

See Also:
Constant Field Values

LOCAL

public static final java.lang.String LOCAL
Local files & catalogs only

See Also:
Constant Field Values

ALWAYS

public static final java.lang.String ALWAYS
Download without asking

See Also:
Constant Field Values

MODES

public static final java.lang.String[] MODES

NETWORK_PROPS

public static final java.lang.String NETWORK_PROPS
See Also:
Constant Field Values

MODE

public static final java.lang.String MODE
Ask before downloading remote files

See Also:
Constant Field Values

CACHE

public static final java.lang.String CACHE
Cache downloaded remote files

See Also:
Constant Field Values

INTERNALCATALOG

public static final java.lang.String INTERNALCATALOG
Internal catalog for DTDs which are packaged in XML.jar and jEdit.jar

See Also:
Constant Field Values
Method Detail

save

public void save()

instance

public static Resolver instance()
Returns:
a global catalog resolver object you can use as an LSResourceResolver or EntityResolver.

resolveResource

public org.w3c.dom.ls.LSInput resolveResource(java.lang.String type,
                                              java.lang.String namespaceURI,
                                              java.lang.String publicId,
                                              java.lang.String systemId,
                                              java.lang.String baseURI)
Specified by:
resolveResource in interface org.w3c.dom.ls.LSResourceResolver

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
implements SAX1 EntityResolver

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException
java.io.IOException
See Also:
DefaultHandler2.resolveEntity(java.lang.String, java.lang.String)

resolveEntityToPath

public java.lang.String resolveEntityToPath(java.lang.String name,
                                            java.lang.String publicId,
                                            java.lang.String current,
                                            java.lang.String systemId)
                                     throws java.io.IOException
Parameters:
name -
publicId -
current -
systemId -
Throws:
java.io.IOException

resolveEntityToPathInternal

public java.lang.String[] resolveEntityToPathInternal(java.lang.String name,
                                                      java.lang.String publicId,
                                                      java.lang.String current,
                                                      java.lang.String systemId)
                                               throws java.io.IOException
systemId may be modified, for instance if resolving docbookx.dtd, the systemId will be the full jeditresource:XML.jar!.../docbookx.dtd

Returns:
array [systemId to report, real systemId]
Throws:
java.io.IOException

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String name,
                                             java.lang.String publicId,
                                             java.lang.String current,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Specified by:
resolveEntity in interface org.xml.sax.ext.EntityResolver2
Throws:
org.xml.sax.SAXException
java.io.IOException

clearCache

public void clearCache()

reloadCatalogs

public void reloadCatalogs()
called from actions.xml


propertiesChanged

public void propertiesChanged()

isUsingCache

public static boolean isUsingCache()

setUsingCache

public static void setUsingCache(boolean newCache)

getNetworkMode

public static java.lang.String getNetworkMode()
Returns:
the network mode: LOCAL, ASK, or ALWAYS

setNetworkMode

public static void setNetworkMode(java.lang.String newMode)

getExternalSubset

public org.xml.sax.InputSource getExternalSubset(java.lang.String name,
                                                 java.lang.String baseURI)
                                          throws org.xml.sax.SAXException,
                                                 java.io.IOException
Specified by:
getExternalSubset in interface org.xml.sax.ext.EntityResolver2
Throws:
org.xml.sax.SAXException
java.io.IOException