Class CatalogResolver
- java.lang.Object
-
- org.apache.xml.resolver.tools.CatalogResolver
-
- All Implemented Interfaces:
javax.xml.transform.URIResolver,org.xml.sax.EntityResolver
public class CatalogResolver extends java.lang.Object implements org.xml.sax.EntityResolver, javax.xml.transform.URIResolverA SAX EntityResolver/JAXP URIResolver that uses catalogs.This class implements both a SAX EntityResolver and a JAXP URIResolver.
This resolver understands OASIS TR9401 catalogs, XCatalogs, and the current working draft of the OASIS Entity Resolution Technical Committee specification.
- Version:
- 1.0
- Author:
- Norman Walsh Norman.Walsh@Sun.COM
- See Also:
Catalog,EntityResolver,URIResolver
-
-
Field Summary
Fields Modifier and Type Field Description booleannamespaceAwareMake the parser Namespace aware?booleanvalidatingMake the parser validating?
-
Constructor Summary
Constructors Constructor Description CatalogResolver()ConstructorCatalogResolver(boolean privateCatalog)ConstructorCatalogResolver(CatalogManager manager)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CataloggetCatalog()Return the underlying catalogjava.lang.StringgetResolvedEntity(java.lang.String publicId, java.lang.String systemId)Implements the guts of theresolveEntitymethod for the SAX interface.javax.xml.transform.Sourceresolve(java.lang.String href, java.lang.String base)JAXP URIResolver APIorg.xml.sax.InputSourceresolveEntity(java.lang.String publicId, java.lang.String systemId)Implements theresolveEntitymethod for the SAX interface.
-
-
-
Constructor Detail
-
CatalogResolver
public CatalogResolver()
Constructor
-
CatalogResolver
public CatalogResolver(boolean privateCatalog)
Constructor
-
CatalogResolver
public CatalogResolver(CatalogManager manager)
Constructor
-
-
Method Detail
-
getCatalog
public Catalog getCatalog()
Return the underlying catalog
-
getResolvedEntity
public java.lang.String getResolvedEntity(java.lang.String publicId, java.lang.String systemId)Implements the guts of theresolveEntitymethod for the SAX interface.Presented with an optional public identifier and a system identifier, this function attempts to locate a mapping in the catalogs.
If such a mapping is found, it is returned. If no mapping is found, null is returned.
- Parameters:
publicId- The public identifier for the entity in question. This may be null.systemId- The system identifier for the entity in question. XML requires a system identifier on all external entities, so this value is always specified.- Returns:
- The resolved identifier (a URI reference).
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)Implements theresolveEntitymethod for the SAX interface.Presented with an optional public identifier and a system identifier, this function attempts to locate a mapping in the catalogs.
If such a mapping is found, the resolver attempts to open the mapped value as an InputSource and return it. Exceptions are ignored and null is returned if the mapped value cannot be opened as an input source.
If no mapping is found (or an error occurs attempting to open the mapped value as an input source), null is returned and the system will use the specified system identifier as if no entityResolver was specified.
- Specified by:
resolveEntityin interfaceorg.xml.sax.EntityResolver- Parameters:
publicId- The public identifier for the entity in question. This may be null.systemId- The system identifier for the entity in question. XML requires a system identifier on all external entities, so this value is always specified.- Returns:
- An InputSource for the mapped identifier, or null.
-
resolve
public javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base) throws javax.xml.transform.TransformerExceptionJAXP URIResolver API- Specified by:
resolvein interfacejavax.xml.transform.URIResolver- Throws:
javax.xml.transform.TransformerException
-
-