Class Resolver
- All Implemented Interfaces:
URIResolver, LSResourceResolver, EntityResolver, EntityResolver2, NamespaceResolver
- Direct Known Subclasses:
XercesResolver
This class is probably the most common entry point to the XML Catalog resolver. It has a zero
argument constructor so it can be instantiated directly from its class name (for example, passed to
an application as a commend line argument or stored in a configuration file). When instantiated
this way, it will automatically be configured by system properties and an xmlresolver.properties
configuration file, if one exists.
This class implements the EntityResolver, EntityResolver2,
LSResourceResolver
and NamespaceResolver, and URIResolver interfaces.
The StAX XMLResolver interface is implemented by the
StAXResolver class because the resolveEntity method
of the XMLResolver interface isn't compatible with the EntityResolver2
method of the same name.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final XMLResolverConfigurationstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final CatalogResolver -
Constructor Summary
ConstructorsConstructorDescriptionResolver()Creates a new instance of Resolver.Resolver(CatalogResolver resolver) Creates a new instance of a Resolver.Resolver(XMLResolverConfiguration config) Creates a new instance of a Resolver. -
Method Summary
Modifier and TypeMethodDescriptionGet the underlyingCatalogResolverused by this resolver.Get the Catalog used by this resolver.getExternalSubset(String name, String baseURI) Implements theEntityResolver2interface.protected ResolvedResourceopenConnection(String uri, String baseURI, boolean asEntity) protected ResolvedResourceopenConnection(URI originalURI, boolean asEntity) Implements theURIResolverinterface.resolveEntity(String publicId, String systemId) Implements theEntityResolverinterface.resolveEntity(String name, String publicId, String baseURI, String systemId) Implements theEntityResolver2interface.resolveNamespace(String uri, String nature, String purpose) Implements theNamespaceResolverinterface.Implements theLSResourceResolverinterface.static Stringversion()What version is this? Returns the version number of this resolver instance.
-
Field Details
-
PURPOSE_SCHEMA_VALIDATION
- See Also:
-
NATURE_XML_SCHEMA
- See Also:
-
NATURE_XML_SCHEMA_1_1
- See Also:
-
NATURE_RELAX_NG
- See Also:
-
config
-
resolver
-
-
Constructor Details
-
Resolver
public Resolver()Creates a new instance of Resolver. The default resolver is a new ResourceResolver that uses a static catalog shared by all threads. -
Resolver
Creates a new instance of a Resolver. Creates a resolver using a specific Catalog.- Parameters:
config- The configuration to use.
-
Resolver
Creates a new instance of a Resolver. Creates a resolver using a specific underlying ResourceResolver.- Parameters:
resolver- The resource resolver to use.
-
-
Method Details
-
version
What version is this? Returns the version number of this resolver instance.- Returns:
- The version number
-
getConfiguration
Get the Catalog used by this resolver.- Returns:
- The underlying catalog.
-
getCatalogResolver
Get the underlyingCatalogResolverused by this resolver.- Returns:
- The catalog resolver.
-
resolve
Implements theURIResolverinterface.- Specified by:
resolvein interfaceURIResolver- Throws:
TransformerException
-
resolveResource
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) Implements theLSResourceResolverinterface.- Specified by:
resolveResourcein interfaceLSResourceResolver
-
getExternalSubset
Implements theEntityResolver2interface.- Specified by:
getExternalSubsetin interfaceEntityResolver2- Throws:
SAXExceptionIOException
-
resolveEntity
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException Implements theEntityResolver2interface.- Specified by:
resolveEntityin interfaceEntityResolver2- Throws:
SAXExceptionIOException
-
resolveEntity
Implements theEntityResolverinterface.- Specified by:
resolveEntityin interfaceEntityResolver- Throws:
SAXExceptionIOException
-
resolveNamespace
public Source resolveNamespace(String uri, String nature, String purpose) throws TransformerException Implements theNamespaceResolverinterface.- Specified by:
resolveNamespacein interfaceNamespaceResolver- Parameters:
uri- The namespace URI.nature- The RDDL nature of the resource.purpose- The RDDL purpose of the resource.- Returns:
- A Source object, or null if the href cannot be resolved, and the processor should try to resolve the URI itself.
- Throws:
TransformerException- If an error occurs
-
openConnection
protected ResolvedResource openConnection(String uri, String baseURI, boolean asEntity) throws IOException - Throws:
IOException
-
openConnection
- Throws:
IOException
-