Class Resolver
- java.lang.Object
-
- org.xmlresolver.Resolver
-
- All Implemented Interfaces:
javax.xml.transform.URIResolver
,org.w3c.dom.ls.LSResourceResolver
,org.xml.sax.EntityResolver
,org.xml.sax.ext.EntityResolver2
,NamespaceResolver
- Direct Known Subclasses:
XercesResolver
public class Resolver extends java.lang.Object implements javax.xml.transform.URIResolver, org.xml.sax.EntityResolver, org.xml.sax.ext.EntityResolver2, NamespaceResolver, org.w3c.dom.ls.LSResourceResolver
An implementation of many resolver interfaces.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
andNamespaceResolver
, andURIResolver
interfaces.The StAX
XMLResolver
interface is implemented by theStAXResolver
class because theresolveEntity
method of theXMLResolver
interface isn't compatible with theEntityResolver2
method of the same name.- See Also:
StAXResolver
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NATURE_RELAX_NG
static java.lang.String
NATURE_XML_SCHEMA
static java.lang.String
NATURE_XML_SCHEMA_1_1
static java.lang.String
PURPOSE_SCHEMA_VALIDATION
-
Constructor Summary
Constructors Constructor Description Resolver()
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CatalogResolver
getCatalogResolver()
Get the underlyingCatalogResolver
used by this resolver.XMLResolverConfiguration
getConfiguration()
Get the Catalog used by this resolver.org.xml.sax.InputSource
getExternalSubset(java.lang.String name, java.lang.String baseURI)
Implements theEntityResolver2
interface.javax.xml.transform.Source
resolve(java.lang.String href, java.lang.String base)
Implements theURIResolver
interface.org.xml.sax.InputSource
resolveEntity(java.lang.String publicId, java.lang.String systemId)
Implements theEntityResolver
interface.org.xml.sax.InputSource
resolveEntity(java.lang.String name, java.lang.String publicId, java.lang.String baseURI, java.lang.String systemId)
Implements theEntityResolver2
interface.javax.xml.transform.Source
resolveNamespace(java.lang.String uri, java.lang.String nature, java.lang.String purpose)
Implements theNamespaceResolver
interface.org.w3c.dom.ls.LSInput
resolveResource(java.lang.String type, java.lang.String namespaceURI, java.lang.String publicId, java.lang.String systemId, java.lang.String baseURI)
Implements theLSResourceResolver
interface.static java.lang.String
version()
What version is this? Returns the version number of this resolver instance.
-
-
-
Field Detail
-
PURPOSE_SCHEMA_VALIDATION
public static final java.lang.String PURPOSE_SCHEMA_VALIDATION
- See Also:
- Constant Field Values
-
NATURE_XML_SCHEMA
public static final java.lang.String NATURE_XML_SCHEMA
- See Also:
- Constant Field Values
-
NATURE_XML_SCHEMA_1_1
public static final java.lang.String NATURE_XML_SCHEMA_1_1
- See Also:
- Constant Field Values
-
NATURE_RELAX_NG
public static final java.lang.String NATURE_RELAX_NG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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
public Resolver(XMLResolverConfiguration config)
Creates a new instance of a Resolver. Creates a resolver using a specific Catalog.- Parameters:
config
- The configuration to use.
-
Resolver
public Resolver(CatalogResolver resolver)
Creates a new instance of a Resolver. Creates a resolver using a specific underlying ResourceResolver.- Parameters:
resolver
- The resource resolver to use.
-
-
Method Detail
-
version
public static java.lang.String version()
What version is this? Returns the version number of this resolver instance.- Returns:
- The version number
-
getConfiguration
public XMLResolverConfiguration getConfiguration()
Get the Catalog used by this resolver.- Returns:
- The underlying catalog.
-
getCatalogResolver
public CatalogResolver getCatalogResolver()
Get the underlyingCatalogResolver
used by this resolver.- Returns:
- The catalog resolver.
-
resolve
public javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base) throws javax.xml.transform.TransformerException
Implements theURIResolver
interface.- Specified by:
resolve
in interfacejavax.xml.transform.URIResolver
- Throws:
javax.xml.transform.TransformerException
-
resolveResource
public org.w3c.dom.ls.LSInput resolveResource(java.lang.String type, java.lang.String namespaceURI, java.lang.String publicId, java.lang.String systemId, java.lang.String baseURI)
Implements theLSResourceResolver
interface.- Specified by:
resolveResource
in interfaceorg.w3c.dom.ls.LSResourceResolver
-
getExternalSubset
public org.xml.sax.InputSource getExternalSubset(java.lang.String name, java.lang.String baseURI) throws org.xml.sax.SAXException, java.io.IOException
Implements theEntityResolver2
interface.- Specified by:
getExternalSubset
in interfaceorg.xml.sax.ext.EntityResolver2
- Throws:
org.xml.sax.SAXException
java.io.IOException
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String name, java.lang.String publicId, java.lang.String baseURI, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
Implements theEntityResolver2
interface.- Specified by:
resolveEntity
in interfaceorg.xml.sax.ext.EntityResolver2
- Throws:
org.xml.sax.SAXException
java.io.IOException
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
Implements theEntityResolver
interface.- Specified by:
resolveEntity
in interfaceorg.xml.sax.EntityResolver
- Throws:
org.xml.sax.SAXException
java.io.IOException
-
resolveNamespace
public javax.xml.transform.Source resolveNamespace(java.lang.String uri, java.lang.String nature, java.lang.String purpose) throws javax.xml.transform.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:
javax.xml.transform.TransformerException
- If an error occurs
-
-