PhoenixmlDb.Core
SchemaCompiler
Compiles a schema from root documents, reading every document of it through one or from the documents the host supplies.
#SchemaCompiler
Namespace: PhoenixmlDb.Core.Schema
Compiles a schema from root documents, reading every document of it through one
or from the
documents the host supplies.
A compilation has two steps. First the whole closure is read: the roots, then every document they include, import or redefine, and so on, each one once, each through the gate or from a source, within the limits of
. Then the schema is compiled from what was read, in memory. Nothing is fetched during the second step: a document the schema compiler asks for that the first step did not read fails the compilation.
#Methods
#Build(Uri[],PhoenixmlDb.Core.Schema.SchemaCompiler.Closure,Collections.Generic.List<PhoenixmlDb.Core.Schema.SchemaDiagnostic>,Nullable<TimeSpan>)
The second step: compile from the documents that were read, fetching nothing.
#Compile(Collections.Generic.IEnumerable<Uri>,PhoenixmlDb.Core.Schema.ISchemaAccessGate,Collections.Generic.IEnumerable<PhoenixmlDb.Core.Schema.SchemaSource>,PhoenixmlDb.Core.Schema.SchemaCompileOptions)
for a caller that cannot wait asynchronously. It blocks the calling thread until the gate and the sources have answered, so it is for hosts whose gate and sources answer at once (files, text, resources) or that may block a thread.
#CompileAsync(Collections.Generic.IEnumerable<Uri>,PhoenixmlDb.Core.Schema.ISchemaAccessGate,Collections.Generic.IEnumerable<PhoenixmlDb.Core.Schema.SchemaSource>,PhoenixmlDb.Core.Schema.SchemaCompileOptions,Threading.CancellationToken)
Compiles the schema rooted at
.
Parameters:
-
roots— The absolute URIs of the root documents. -
gate— Reads every document thatsourcesdoes not supply. -
sources— Documents the host supplies, each named by its URI. -
options— Limits on what is read;SchemaCompileOptions.Defaultwhen null. -
cancellationToken— Given to the gate and the sources, and looked at between documents. The compile step itself, once everything is read, cannot be interrupted.
Exceptions:
-
SchemaCompilationException— A document is not available, is too large, is not well-formed, has a document type declaration or nests too deeply, or the schema does not compile.SchemaCompilationException.Diagnosticshas what was reported. -
OperationCanceledException— The token was cancelled.
#Read(Collections.Generic.IEnumerable<Uri>,PhoenixmlDb.Core.Schema.ISchemaAccessGate,Collections.Generic.IEnumerable<PhoenixmlDb.Core.Schema.SchemaSource>,PhoenixmlDb.Core.Schema.SchemaCompileOptions)
#ReadAsync(Collections.Generic.IEnumerable<Uri>,PhoenixmlDb.Core.Schema.ISchemaAccessGate,Collections.Generic.IEnumerable<PhoenixmlDb.Core.Schema.SchemaSource>,PhoenixmlDb.Core.Schema.SchemaCompileOptions,Threading.CancellationToken)
The first step alone: reads the closure of
exactly as
does, and returns the documents for a caller that adds them to a schema set of its own (the XQuery schema provider, whose set grows with each import).
Exceptions:
-
SchemaCompilationException— A document could not be read, or is not allowed.
#Fields
| Name | Description |
|---|---|
MaxNestingDepth
|
How deeply a schema document's elements may nest. Real schemas stay well under a hundred levels, and the schema loader slows sharply with depth and cannot be cancelled, so a small document nested tens of thousands of levels deep could occupy a host for minutes. |