Package com.saxonica.ee.s9api
Class SchemaManagerImpl
- java.lang.Object
-
- net.sf.saxon.s9api.SchemaManager
-
- com.saxonica.ee.s9api.SchemaManagerImpl
-
public class SchemaManagerImpl extends SchemaManager
The SchemaManager is used to load schema documents, and to set options for the way in which they are loaded. At present all the resulting schema components are held in a single pool owned by the Processor object.
-
-
Constructor Summary
Constructors Constructor Description SchemaManagerImpl(Processor processor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exportComponents(Destination destination)
Export a precompiled Schema Component Model containing all the components (except built-in components) that have been loaded into this Processor.javax.xml.transform.ErrorListener
getErrorListener()
Get the ErrorListener being used while loading and validating schema documentsErrorReporter
getErrorReporter()
SchemaURIResolver
getSchemaURIResolver()
Get the SchemaURIResolver to be used during schema loading.java.lang.String
getXsdVersion()
Get the version of XSD in use.void
importComponents(javax.xml.transform.Source source)
Import a precompiled Schema Component Model from a given Source.void
load(javax.xml.transform.Source source)
Load a schema document from a given Source.SchemaValidator
newSchemaValidator()
Create a SchemaValidator which can be used to validate instance documents against the schema held by this SchemaManagervoid
setErrorListener(javax.xml.transform.ErrorListener listener)
Set the ErrorListener to be used while loading and validating schema documentsvoid
setErrorReporter(ErrorReporter reporter)
void
setSchemaURIResolver(SchemaURIResolver resolver)
Set the SchemaURIResolver to be used during schema loading.void
setXsdVersion(java.lang.String version)
Set the version of XSD in use.-
Methods inherited from class net.sf.saxon.s9api.SchemaManager
load
-
-
-
-
Constructor Detail
-
SchemaManagerImpl
public SchemaManagerImpl(Processor processor)
-
-
Method Detail
-
setXsdVersion
public void setXsdVersion(java.lang.String version)
Set the version of XSD in use. The value must be "1.0" or "1.1". The default is currently "1.0", but this may change in a future release.- Specified by:
setXsdVersion
in classSchemaManager
- Parameters:
version
- the version of the XSD specification/language: either "1.0" or "1.1".
-
getXsdVersion
public java.lang.String getXsdVersion()
Get the version of XSD in use. The value will be "1.0" or "1.1"- Specified by:
getXsdVersion
in classSchemaManager
- Returns:
- the version of XSD in use.
-
setErrorListener
public void setErrorListener(javax.xml.transform.ErrorListener listener)
Set the ErrorListener to be used while loading and validating schema documents- Specified by:
setErrorListener
in classSchemaManager
- Parameters:
listener
- The error listener to be used. This is notified of all errors detected during the compilation. May be set to null to revert to the default ErrorListener.
-
getErrorListener
public javax.xml.transform.ErrorListener getErrorListener()
Get the ErrorListener being used while loading and validating schema documents- Specified by:
getErrorListener
in classSchemaManager
- Returns:
- listener The error listener in use. This is notified of all errors detected during the compilation. Returns null if no user-supplied ErrorListener has been set.
-
setErrorReporter
public void setErrorReporter(ErrorReporter reporter)
- Specified by:
setErrorReporter
in classSchemaManager
-
getErrorReporter
public ErrorReporter getErrorReporter()
- Specified by:
getErrorReporter
in classSchemaManager
-
setSchemaURIResolver
public void setSchemaURIResolver(SchemaURIResolver resolver)
Set the SchemaURIResolver to be used during schema loading. This SchemaURIResolver, despite its name, is not used for resolving relative URIs against a base URI; it is used for dereferencing an absolute URI (after resolution) to return aSource
representing the location where a schema document can be found.This SchemaURIResolver is used to dereference the URIs appearing in
xs:import
,xs:include
, andxs:redefine
declarations.- Specified by:
setSchemaURIResolver
in classSchemaManager
- Parameters:
resolver
- the SchemaURIResolver to be used during schema loading.
-
getSchemaURIResolver
public SchemaURIResolver getSchemaURIResolver()
Get the SchemaURIResolver to be used during schema loading.- Specified by:
getSchemaURIResolver
in classSchemaManager
- Returns:
- the URIResolver used during stylesheet compilation. Returns null if no user-supplied URIResolver has been set.
-
load
public void load(javax.xml.transform.Source source) throws SaxonApiException
Load a schema document from a given Source. The schema components derived from this schema document are added to the cache of schema components maintained by this SchemaManager.If the source is a
StreamSource
containing a systemId but noInputStream
orReader
, then an attempt is made to resolve the systemId using the resource resolver registered with theConfiguration
. It is NOT resolved using theSchemaURIResolver
(this is used only for included and imported modules).- Specified by:
load
in classSchemaManager
- Parameters:
source
- the document containing the schema. The getSystemId() method applied to this Source must return a base URI suitable for resolvingxs:include
andxs:import
directives. The document may be either a schema document in source XSD format, or a compiled schema in Saxon-defined SCM format (as produced using the -export option)- Throws:
SaxonApiException
- if the schema document is not valid, or if its contents are inconsistent with the schema components already held by this SchemaManager.
-
importComponents
public void importComponents(javax.xml.transform.Source source) throws SaxonApiException
Import a precompiled Schema Component Model from a given Source. The schema components derived from this schema document are added to the cache of schema components maintained by this SchemaManager- Specified by:
importComponents
in classSchemaManager
- Parameters:
source
- the XML file containing the schema component model, as generated by a previous call onexportComponents(net.sf.saxon.s9api.Destination)
- Throws:
SaxonApiException
- if a failure occurs loading the schema from the supplied source
-
exportComponents
public void exportComponents(Destination destination) throws SaxonApiException
Export a precompiled Schema Component Model containing all the components (except built-in components) that have been loaded into this Processor.- Specified by:
exportComponents
in classSchemaManager
- Parameters:
destination
- the destination to recieve the precompiled Schema Component Model in the form of an XML document- Throws:
SaxonApiException
- if a failure occurs writing the schema components to the supplied destination
-
newSchemaValidator
public SchemaValidator newSchemaValidator()
Create a SchemaValidator which can be used to validate instance documents against the schema held by this SchemaManager- Specified by:
newSchemaValidator
in classSchemaManager
- Returns:
- a new SchemaValidator
-
-