public abstract class SchemaManager
extends java.lang.Object
To obtain a SchemaManager
, use the method Processor.getSchemaManager()
.
In a schema-aware Processor there is exactly one
SchemaManager
(in a non-schema-aware Processor there is none).
The cache of compiled schema definitions can include only one schema component (for example a type, or an element declaration) with any given name. An attempt to compile two different schemas in the same namespace will usually therefore fail.
As soon as a type definition or element declaration is used for the first time in a validation episode, it is marked as being "sealed": this prevents subsequent modifications to the component. Examples of modifications that are thereby disallowed include adding to the substitution group of an existing element declaration, adding subtypes to an existing type, or redefining components using <xs:redefine>
Constructor and Description |
---|
SchemaManager() |
Modifier and Type | Method and Description |
---|---|
abstract 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.
|
abstract javax.xml.transform.ErrorListener |
getErrorListener()
Get the ErrorListener being used while loading and validating schema documents
|
abstract SchemaURIResolver |
getSchemaURIResolver()
Get the SchemaURIResolver to be used during schema loading.
|
abstract java.lang.String |
getXsdVersion()
Get the version of XSD in use.
|
abstract void |
importComponents(javax.xml.transform.Source source)
Import a precompiled Schema Component Model from a given Source.
|
abstract void |
load(javax.xml.transform.Source source)
Load a schema document from a given Source.
|
abstract SchemaValidator |
newSchemaValidator()
Create a SchemaValidator which can be used to validate instance documents against the schema held by this
SchemaManager
|
abstract void |
setErrorListener(javax.xml.transform.ErrorListener listener)
Set the ErrorListener to be used while loading and validating schema documents
|
abstract void |
setSchemaURIResolver(SchemaURIResolver resolver)
Set the SchemaURIResolver to be used during schema loading.
|
abstract void |
setXsdVersion(java.lang.String version)
Set the version of XSD in use.
|
public abstract void setXsdVersion(java.lang.String version)
version
- the version of the XSD specification/language: either "1.0" or "1.1".public abstract java.lang.String getXsdVersion()
public abstract void setErrorListener(javax.xml.transform.ErrorListener listener)
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.public abstract javax.xml.transform.ErrorListener getErrorListener()
public abstract void setSchemaURIResolver(SchemaURIResolver resolver)
Source
representing the
location where a schema document can be found.
This SchemaURIResolver is used to dereference the URIs appearing in xs:import
,
xs:include
, and xs:redefine
declarations.
resolver
- the SchemaURIResolver to be used during schema loading.public abstract SchemaURIResolver getSchemaURIResolver()
public abstract void load(javax.xml.transform.Source source) throws SaxonApiException
source
- the document containing the schema. The getSystemId() method applied to this Source
must return a base URI suitable for resolving xs:include
and xs: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)SaxonApiException
- if the schema document is not valid, or if its contents are inconsistent
with the schema components already held by this SchemaManager.public abstract void importComponents(javax.xml.transform.Source source) throws SaxonApiException
source
- the XML file containing the schema component model, as generated by a previous call on
exportComponents(net.sf.saxon.s9api.Destination)
SaxonApiException
- if a failure occurs loading the schema from the supplied sourcepublic abstract void exportComponents(Destination destination) throws SaxonApiException
destination
- the destination to recieve the precompiled Schema Component Model in the form of an
XML documentSaxonApiException
- if a failure occurs writing the schema components to the supplied destinationpublic abstract SchemaValidator newSchemaValidator()
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.