org.sape.carbon.core.config.format.jdom
Class ConfigEntityResolver

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.sape.carbon.core.config.format.jdom.ConfigEntityResolver
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class ConfigEntityResolver
extends DefaultHandler

Used to resolve entities in the JDOMConfigurationFactory. The major functionality added in this over the DefaultHandler is the ability to specify locations inside the classpath for enties such as classpath://com/sapient/foo.dtd thus allowing the validation documents to be inside the jars of the functional classes.

Copyright 2002 Sapient

Since:
carbon 2.0
Version:
$Revision: 1.5 $($Author: dvoet $ / $Date: 2003/05/05 21:21:17 $)
Author:
Jordan Reed, March 2003

Field Summary
private static String CLASSPATH_PREFIX
          Protocol prefix indicating to classload the path.
protected  String name
          Holds the name of the node being loaded.
 
Constructor Summary
ConfigEntityResolver(String name)
          Constructs a new ConfigEntityResolver.
 
Method Summary
 InputSource resolveEntity(String publicId, String systemId)
          Resolves the external entity.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSPATH_PREFIX

private static final String CLASSPATH_PREFIX
Protocol prefix indicating to classload the path.

See Also:
Constant Field Values

name

protected String name
Holds the name of the node being loaded.

Constructor Detail

ConfigEntityResolver

public ConfigEntityResolver(String name)
Constructs a new ConfigEntityResolver.

Parameters:
name - the name of the node being loaded.
Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException
Resolves the external entity.

The only functionality added here is to check for the CLASSPATH_PREFIX and then attempt to classload the external entity from the location given. If there is no CLASSPATH_PREFIX or it fails to load, it will pass off resolution to the DefaultHandler it extends.

Specified by:
resolveEntity in interface EntityResolver
Overrides:
resolveEntity in class DefaultHandler
Parameters:
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.
Returns:
An InputSource object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.
Throws:
SAXException - indicates an error resolving the entity


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.