Saxon.Api
Class XsdCompiler
-
public abstract class XsdCompiler
An XsdCompiler object allows XSD schema documents to be compiled.
The compiler holds information options controlling how the schema is compiled.
To construct an XsdCompiler, use the factory method
NewXsdCompiler on the XsdCompiler.Processor object.
An XsdCompiler may be used repeatedly to compile multiple
schemas. Any changes made to the XsdCompiler
do not affect schemas that have already been compiled.
An XsdCompiler may be used concurrently in multiple threads, but
it should not then be modified once initialized.
The abstract XsdCompiler class is included in all Saxon editions,
but the concrete subclass that does real schema processing is available
only in Saxon-EE.
Nested Classes |
|
|---|---|
| class | XsdCompiler.SchemaSource Embedded class defining the source for a particular schema document. |
Property Summary |
|
|---|---|
| ErrorReporter | ErrorReporter The |
| Processor | Processor
The |
| SchemaResolver | SchemaResolver The |
| string | XsdVersion
The version of the W3C XML Schema Specification handled by this |
Method Summary |
|
|---|---|
| XsdSchema | Combine (XsdSchema[] schemas) Combine a set of schemas into one |
| XsdSchema | Compile (XsdCompiler.SchemaSource[] sources)
Load a schema document from a given SchemaSource, or from a set of SchemaSources.
The schema components are returned
by the method as an |
| XsdSchema | Compile (Stream input)
Compile a schema supplied as a |
| XsdSchema | Compile (Stream input, Uri baseUri)
Compile a schema supplied as a |
| XsdSchema | Compile (TextReader input, Uri baseUri)
Compile a schema supplied as a |
| XsdSchema | Compile (TextReader reader)
Compile a schema supplied as a |
| XsdSchema | Compile (Uri uri) Compile a schema, retrieving the source using a URI. |
| XsdSchema | Compile (FileInfo file) Compile a schema, retrieving the source from a given file. |
| XsdSchema | Compile (XmlReader reader)
Compile a schema, retrieving the source from a supplied XML reader
(that is, an XML parser). The base URI of the document is taken
from the |
| XsdSchema | Compile (XdmNode node)
Compile a schema, retrieving the source from a supplied XDM node.
This may be a document node whose
child is an |
| XsdSchema | 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 using {@code xsi:schemaLocation} and {@code xsi:noNamespaceSchemaLocation} attributes |
| XsdSchema | ImportComponents (XsdCompiler.SchemaSource source) 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 XsdCompiler |
Property Detail
ErrorReporter
The ErrorReporter to be used when compiling schema documents.
Processor
The Processor that was used to create this XsdCompiler
SchemaResolver
The SchemaResolver to be used when resolving references to schema documents.
XsdVersion
The version of the W3C XML Schema Specification handled by this XsdCompiler.
The value must be "1.0" (indicating XML Schema 1.0) or "1.1" (indicating XML Schema 1.1). The default is "1.0". New constructs defined in XSD 1.1 are rejected unless this property is set to "1.1" before compiling the schema.
Method Detail
Combine
Compile
Load a schema document from a given SchemaSource, or from a set of SchemaSources.
The schema components are returned
by the method as an XsdSchema object.
Parameters:
sources - A set of SchemaSources.Returns:
Compile
Compile a schema supplied as a Stream. The resulting schema components are added
to the cache. The base URI of the schema document is taken as the current working
directory.
Parameters:
input - A stream containing the source text of the schema. This method
will consume the supplied stream. It is the caller's responsibility to close the stream
after use.Returns:
Compile
Compile a schema supplied as a Stream. The resulting schema components are added
to the cache.
Parameters:
input - A stream containing the source text of the schema. This method
will consume the supplied stream. It is the caller's responsibility to close the stream
after use.baseUri - The base URI of the schema document, for resolving any references to other
schema documentsReturns:
Compile
Uri baseUri)
Compile a schema supplied as a TextReader. The resulting schema components are added
to the cache.
Parameters:
input - A TextReader that supplies the source text of the schema. This method
will consume the supplied stream. It is the caller's responsibility to close the reader
after use.baseUri - The base URI of the schema document, for resolving any references to other
schema documentsReturns:
Compile
Compile a schema supplied as a TextReader. The base URI of the schema document is
taken as the current working directory.
Parameters:
reader - A TextReader that supplies the source text of the schema. This method
will consume the supplied stream. It is the caller's responsibility to close the reader
after use.Returns:
Compile
Compile a schema, retrieving the source using a URI.
The document located via the URI is parsed using the System.Xml parser.
Parameters:
uri - The URI identifying the location where the schema document can be
foundReturns:
Compile
Compile a schema, retrieving the source from a given file.
The content of the file is parsed using the System.Xml parser.
Parameters:
file - The file where the schema document can be
foundReturns:
Compile
Compile a schema, retrieving the source from a supplied XML reader
(that is, an XML parser). The base URI of the document is taken
from the BaseUri property of the XmlReader.
Parameters:
reader - The XML reader supplying
the schema documentReturns:
Compile
Compile a schema, retrieving the source from a supplied XDM node.
This may be a document node whose
child is an xs:schema element, or it may be
the xs:schema element itself.
The base URI of the document is taken
from the BaseUri property of the XdmNode.
Parameters:
node - The XML reader supplying
the schema documentReturns:
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 using {@code xsi:schemaLocation} and {@code xsi:noNamespaceSchemaLocation} attributes
Returns:
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 XsdCompiler
Parameters:
source - The XML file containing the schema component model, as generated by a previous call
on
XsdSchema#exportComponents
Returns:
Combine a set of schemas into one
Parameters:
schemas- The schemas to be combinedReturns: