Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.xerces.readers
Class XMLCatalogHandler  view XMLCatalogHandler download XMLCatalogHandler.java

java.lang.Object
  extended byorg.apache.xerces.readers.XMLCatalogHandler
All Implemented Interfaces:
org.xml.sax.EntityResolver
Direct Known Subclasses:
XCatalog

public abstract class XMLCatalogHandler
extends java.lang.Object
implements org.xml.sax.EntityResolver

Interface for implementing basic catalog support in the parser. To implement and use a Catalog, implement this interface and install your catalog instance as the EntityResolver in the parser's entity handler. For example:

     XMLParser parser = new AnyParser();
     parser.addCatalogHandler(new MyCatalog());
 

This default catalog implementation does not provide a method for loading multiple catalogs from various input sources. Instead, it is a convenient base class for other catalog implementations.

To create a catalog implementation, simply extend this class and implement the loadCatalog method. Public and system identifier mappings can be stored and accessed using the convenient public methods on this class.

Version:

Field Summary
private  java.util.Hashtable publicMap
          Public identifier mappings.
private  java.util.Hashtable systemMap
          System identifier mappings (aliases).
 
Constructor Summary
XMLCatalogHandler()
           
 
Method Summary
 void addPublicMapping(java.lang.String publicId, java.lang.String systemId)
          Adds a public to system identifier mapping.
 void addSystemMapping(java.lang.String systemId1, java.lang.String systemId2)
          Adds a system identifier alias.
 java.lang.String getPublicMapping(java.lang.String publicId)
          Returns a public identifier mapping.
 java.util.Enumeration getPublicMappingKeys()
          Returns an enumeration of public identifier mapping keys.
 java.lang.String getSystemMapping(java.lang.String systemId)
          Returns a system identifier alias.
 java.util.Enumeration getSystemMappingKeys()
          Returns an enumeration of system identifier mapping keys.
abstract  void loadCatalog(org.xml.sax.InputSource source)
          Loads the catalog stream specified by the given input source and appends the contents to the catalog.
 void removePublicMapping(java.lang.System publicId)
          Removes a public identifier mapping.
 void removeSystemMapping(java.lang.String systemId)
          Removes a system identifier alias.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolves external entities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

publicMap

private java.util.Hashtable publicMap
Public identifier mappings.


systemMap

private java.util.Hashtable systemMap
System identifier mappings (aliases).

Constructor Detail

XMLCatalogHandler

public XMLCatalogHandler()
Method Detail

loadCatalog

public abstract void loadCatalog(org.xml.sax.InputSource source)
                          throws java.lang.Exception
Loads the catalog stream specified by the given input source and appends the contents to the catalog.


addPublicMapping

public void addPublicMapping(java.lang.String publicId,
                             java.lang.String systemId)
Adds a public to system identifier mapping.


removePublicMapping

public void removePublicMapping(java.lang.System publicId)
Removes a public identifier mapping.


getPublicMappingKeys

public java.util.Enumeration getPublicMappingKeys()
Returns an enumeration of public identifier mapping keys.


getPublicMapping

public java.lang.String getPublicMapping(java.lang.String publicId)
Returns a public identifier mapping.


addSystemMapping

public void addSystemMapping(java.lang.String systemId1,
                             java.lang.String systemId2)
Adds a system identifier alias.


removeSystemMapping

public void removeSystemMapping(java.lang.String systemId)
Removes a system identifier alias.


getSystemMappingKeys

public java.util.Enumeration getSystemMappingKeys()
Returns an enumeration of system identifier mapping keys.


getSystemMapping

public java.lang.String getSystemMapping(java.lang.String systemId)
Returns a system identifier alias.


resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Resolves external entities.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver