BEA Systems, Inc.


weblogic.apache.xerces.readers
Class XMLCatalogHandler

java.lang.Object
  |
  +--weblogic.apache.xerces.readers.XMLCatalogHandler
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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Author:
Andy Clark, IBM
See Also:
EntityResolver

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
 

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.

Parameters:
source - The catalog source.
Throws:
java.lang.Exception - Throws an exception if an error occurs while loading the catalog source.

addPublicMapping

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

Parameters:
publicId - The public identifier, or "key".
systemId - The system identifier, or "value".

removePublicMapping

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

Parameters:
publicId - The public identifier to remove.

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.

Parameters:
publicId - The public identifier, or "key".
Returns:
Returns the system identifier value or null if there is no mapping defined.

addSystemMapping

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

Parameters:
publicId - The system identifier "key".
systemId - The system identifier "value".

removeSystemMapping

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

Parameters:
systemId - The system identifier to remove.

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.

Parameters:
systemId - The system identifier "key".
Returns:
Returns the system identifier alias value or null if there is no alias defined.

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

Parameters:
publicId - The public identifier used for entity resolution.
systemId - If the publicId is not null, this systemId is to be considered the default system identifier; else a system identifier alias mapping is requested.
Returns:
Returns the input source of the resolved entity or null if no resolution is possible.
Throws:
org.xml.sax.SAXException - Exception thrown on SAX error.
java.io.IOException - Exception thrown on i/o error.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs70

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference