Package com.saxonica.ee.s9api
Class XsdCompilerEE
java.lang.Object
net.sf.saxon.s9api.XsdCompiler
com.saxonica.ee.s9api.XsdCompilerEE
An
XsdCompilerEE is used to load schema documents, and to set options for the way in which they are loaded.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCombine a set of schemas into oneLoad a schema document from a given File or set of files.Load schema documents from given Sources.Return an empty schema.Get the ErrorReporter being used while loading and validating schema documentsGet the associated s9api processorGet the SchemaURIResolver to be used during schema loading.Get the version of XSD in use.importComponents(Source source) Import a precompiled Schema Component Model from a given Source.voidsetErrorReporter(ErrorReporter reporter) Set the ErrorReporter to be used while loading and validating schema documentsvoidsetSchemaURIResolver(SchemaURIResolver resolver) Set the SchemaURIResolver to be used during schema loading.voidsetXsdVersion(String version) Set the version of XSD in use for this schema.wrapInternalSchema(Schema internalSchema) Construct anXsdSchemaby wrapping an internal schema object.
-
Constructor Details
-
XsdCompilerEE
-
-
Method Details
-
getProcessor
Get the associated s9api processor- Specified by:
getProcessorin classXsdCompiler- Returns:
- the
Processor
-
setXsdVersion
Set the version of XSD in use for this schema. The value must be "1.0" or "1.1". The default is taken from the configuration propertyFeature.XSD_VERSIONat the time theXsdSchemaCompileris instantiated. By default this is "1.1".- Specified by:
setXsdVersionin classXsdCompiler- Parameters:
version- the version of the XSD specification/language: either "1.0" or "1.1".
-
getXsdVersion
Get the version of XSD in use. The value will be "1.0" or "1.1"- Specified by:
getXsdVersionin classXsdCompiler- Returns:
- the version of XSD in use.
-
setErrorReporter
Set the ErrorReporter to be used while loading and validating schema documents- Specified by:
setErrorReporterin classXsdCompiler- Parameters:
reporter- The error reporter to be used. This is notified of all errors detected during the compilation. May be set to null to revert to the default ErrorReporter.
-
getErrorReporter
Get the ErrorReporter being used while loading and validating schema documents- Specified by:
getErrorReporterin classXsdCompiler- Returns:
- reporter The error reporter in use. This is notified of all errors detected during the compilation. Returns null if no user-supplied ErrorReporter 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 aSourcerepresenting the location where a schema document can be found.This SchemaURIResolver is used to dereference the URIs appearing in
xs:import,xs:include, andxs:redefinedeclarations.- Specified by:
setSchemaURIResolverin classXsdCompiler- Parameters:
resolver- the SchemaURIResolver to be used during schema loading.
-
getSchemaURIResolver
Get the SchemaURIResolver to be used during schema loading.- Specified by:
getSchemaURIResolverin classXsdCompiler- Returns:
- the URIResolver used during stylesheet compilation. Returns null if no user-supplied URIResolver has been set.
-
compile
Load schema documents from given Sources. 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
StreamSourcecontaining a systemId but noInputStreamorReader, 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:
compilein classXsdCompiler- Parameters:
sources- the documents containing the schema. The getSystemId() method applied to each Source must return a base URI suitable for resolvingxs:includeandxs:importdirectives. 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)- Returns:
- the resulting schema.
- Throws:
SaxonApiException- if the schema document is not valid, or if its contents are inconsistent with the schema components already held by this SchemaManager. Note that the method returns without an exception if one or more of the sources cannot be processed, provided that the remaining documents constitute a valid schema.
-
compile
Load a schema document from a given File or set of files. The schema components derived from this schema document are retained by this SchemaManager as the current schema, and are also returned by the method as anXsdSchemaobject.- Specified by:
compilein classXsdCompiler- Parameters:
files- the documents containing the schema. The getSystemId() method applied to this Source must return a base URI suitable for resolvingxs:includeandxs:importdirectives. 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)- Returns:
- the resulting schema.
- Throws:
SaxonApiException- if the schema document is not valid.
-
combine
Combine a set of schemas into one- Specified by:
combinein classXsdCompiler- Parameters:
schemas- the input schemas. These are not modified.- Returns:
- the combined schema
- Throws:
SaxonApiException- if the schemas are not compatible, for example if they contain duplicate names.- Since:
- 13.0
-
emptySchema
Return an empty schema. This may be useful for validating instance documents when all the actual schema definitions are linked from the instance document usingxsi:schemaLocationandxsi:noNamespaceSchemaLocationattributes- Specified by:
emptySchemain classXsdCompiler- Returns:
- an empty schema
-
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- Specified by:
importComponentsin classXsdCompiler- Parameters:
source- the XML file containing the schema component model, as generated by a previous call onXsdSchema.exportComponents(net.sf.saxon.s9api.Destination)- Returns:
- the schema that results from importing the SCM file
- Throws:
SaxonApiException
-
wrapInternalSchema
Construct anXsdSchemaby wrapping an internal schema object. This is intended primarily for internal use- Specified by:
wrapInternalSchemain classXsdCompiler- Parameters:
internalSchema- the internal schema object
-