org.exist.validation.resolver
Class eXistCatalogResolver

java.lang.Object
  extended byorg.exist.validation.resolver.eXistCatalogResolver
All Implemented Interfaces:
org.xml.sax.EntityResolver, javax.xml.transform.URIResolver

public class eXistCatalogResolver
extends java.lang.Object
implements org.xml.sax.EntityResolver, javax.xml.transform.URIResolver

Shared CatalogResolver to be used by the eXist database and the eXist Cocoon web interface. The configuration must be initialized once, typically performed by the database (Configuration class). Consequently the Cocoon interface can reuse the resolver. This resolver guarantees that only one apache.org catalog resolver is being initialized. At this moment the class is just a thin wrapper. To be changed in the near future: Grammar and catalog files can all be stored in the database itself.

Author:
Dannes Wessels
See Also:
Apache.org resolver, XML Entity and URI Resolvers

Constructor Summary
eXistCatalogResolver()
          Constructor.
eXistCatalogResolver(boolean privateCatalog)
          Constructor.
eXistCatalogResolver(org.apache.xml.resolver.CatalogManager manager)
          Constructor.
 
Method Summary
 org.apache.xml.resolver.Catalog getCatalog()
          Return the underlying catalog
 javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base)
          An object that implements this interface that can be called by the processor to turn a URI used in document(), xsl:import, or xsl:include into a Source object.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolve grammar specified by publicId and/or systemId.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

eXistCatalogResolver

public eXistCatalogResolver()
Constructor.


eXistCatalogResolver

public eXistCatalogResolver(boolean privateCatalog)
Constructor.

Parameters:
privateCatalog - TRUE for private catalog, FALSE if not.

eXistCatalogResolver

public eXistCatalogResolver(org.apache.xml.resolver.CatalogManager manager)
Constructor.

Parameters:
manager - Specific catalogmanager to use.
Method Detail

getCatalog

public org.apache.xml.resolver.Catalog getCatalog()
Return the underlying catalog

Returns:
catalog object.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Resolve grammar specified by publicId and/or systemId.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
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:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
java.io.IOException - A Java-specific IO exception, possibly the result of creating a new InputStream or Reader for the InputSource.
See Also:
resolveEntity

resolve

public javax.xml.transform.Source resolve(java.lang.String href,
                                          java.lang.String base)
                                   throws javax.xml.transform.TransformerException
An object that implements this interface that can be called by the processor to turn a URI used in document(), xsl:import, or xsl:include into a Source object.

Specified by:
resolve in interface javax.xml.transform.URIResolver
Parameters:
href - An href attribute, which may be relative or absolute.
base - The base URI in effect when the href attribute was encountered.
Returns:
A Source object, or null if the href cannot be resolved, and the processor should try to resolve the URI itself.
Throws:
javax.xml.transform.TransformerException - if an error occurs when trying to resolve the URI.
See Also:
resolve


Copyright (C) Wolfgang Meier. All rights reserved.