Package net.sf.saxon.s9api
Class SchemaManager
java.lang.Object
net.sf.saxon.s9api.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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
exportComponents
(Destination destination) Export a precompiled Schema Component Model containing all the components (except built-in components) that have been loaded into this Processor.Get the ErrorListener being used while loading and validating schema documentsGet the SchemaURIResolver to be used during schema loading.void
importComponents
(Source source) Import a precompiled Schema Component Model from a given Source.void
Load a schema document from a given Source.Create a SchemaValidator which can be used to validate instance documents against the schema held by this SchemaManagervoid
setErrorListener
(ErrorListener listener) Set the ErrorListener to be used while loading and validating schema documentsvoid
setSchemaURIResolver
(SchemaURIResolver resolver) Set the SchemaURIResolver to be used during schema loading.
-
Constructor Details
-
SchemaManager
-
-
Method Details
-
setErrorListener
Set the ErrorListener to be used while loading and validating schema documents- Parameters:
listener
- The error listener to be used. This is notified of all errors detected during the compilation.
-
getErrorListener
Get the ErrorListener being used while loading and validating schema documents- 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.
-
setSchemaURIResolver
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.- Parameters:
resolver
- the SchemaURIResolver to be used during schema loading.
-
getSchemaURIResolver
Get the SchemaURIResolver to be used during schema loading.- Returns:
- the URIResolver used during stylesheet compilation. Returns null if no user-supplied URIResolver has been set.
-
load
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- 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.- 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
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- Parameters:
source
- the XML file containing the schema component model, as generated by a previous call onexportComponents(net.sf.saxon.s9api.Destination)
- Throws:
SaxonApiException
-
exportComponents
Export a precompiled Schema Component Model containing all the components (except built-in components) that have been loaded into this Processor.- Parameters:
destination
- the destination to recieve the precompiled Schema Component Model in the form of an XML document- Throws:
SaxonApiException
-
newSchemaValidator
Create a SchemaValidator which can be used to validate instance documents against the schema held by this SchemaManager- Returns:
- a new SchemaValidator
-