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 XMLResolverConfiguration
static final String
static final String
static final String
static final String
protected 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 underlyingCatalogResolver
used by this resolver.Get the Catalog used by this resolver.getExternalSubset
(String name, String baseURI) Implements theEntityResolver2
interface.protected ResolvedResource
openConnection
(String uri, String baseURI, boolean asEntity) protected ResolvedResource
openConnection
(URI originalURI, boolean asEntity) Implements theURIResolver
interface.resolveEntity
(String publicId, String systemId) Implements theEntityResolver
interface.resolveEntity
(String name, String publicId, String baseURI, String systemId) Implements theEntityResolver2
interface.resolveNamespace
(String uri, String nature, String purpose) Implements theNamespaceResolver
interface.Implements theLSResourceResolver
interface.static String
version()
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 underlyingCatalogResolver
used by this resolver.- Returns:
- The catalog resolver.
-
resolve
Implements theURIResolver
interface.- Specified by:
resolve
in interfaceURIResolver
- Throws:
TransformerException
-
resolveResource
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) Implements theLSResourceResolver
interface.- Specified by:
resolveResource
in interfaceLSResourceResolver
-
getExternalSubset
Implements theEntityResolver2
interface.- Specified by:
getExternalSubset
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
resolveEntity
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException Implements theEntityResolver2
interface.- Specified by:
resolveEntity
in interfaceEntityResolver2
- Throws:
SAXException
IOException
-
resolveEntity
Implements theEntityResolver
interface.- Specified by:
resolveEntity
in interfaceEntityResolver
- Throws:
SAXException
IOException
-
resolveNamespace
public Source resolveNamespace(String uri, String nature, String purpose) throws TransformerException Implements theNamespaceResolver
interface.- Specified by:
resolveNamespace
in 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
-