Class DocumentBuilder
Class DomDestination
Class DynamicError
Class NullDestination
Class Processor
Class QName
Class SchemaManager
Class SchemaValidator
Class SequenceEnumerator
Class Serializer
Class StaticError
Class TextWriterDestination
Class XPathCompiler
Class XPathExecutable
Class XPathSelector
Class XQueryCompiler
Class XQueryEvaluator
Class XQueryExecutable
Class XdmAtomicValue
Class XdmDestination
Class XdmEmptySequence
Class XdmItem
Class XdmNode
Class XdmValue
Class XmlDestination
Class XsltCompiler
Class XsltExecutable
Class XsltTransformer
Enum RecoveryPolicy
Enum SchemaValidationMode
Enum TreeModel
Enum WhitespacePolicy
Enum XdmAxis
Interface IMessageListener
Interface IQueryResolver
Interface IResultDocumentHandler
Interface IXmlLocation
Interface SchemaResolver
public class SchemaManager
A SchemaManager
is responsible for compiling schemas and
maintaining a cache of compiled schemas that can be used for validating
instance documents.
To obtain a SchemaManager
, use the
SchemaManager
property of the Processor
object.
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>
Property Summary | |
---|---|
|
SchemaResolver
The SchemaResolver is a user-supplied class used for resolving references to
schema documents. It applies to references from one schema document to another
appearing in |
IList |
ErrorList List of errors. The caller may supply an empty list before calling Compile; the processor will then populate the list with error information obtained during the schema compilation. Each error will be included as an object of type StaticError. If no error list is supplied by the caller, error information will be written to the standard error stream. |
Method Summary | |
---|---|
void |
Compile(System.IO.Stream input, System.Uri baseUri) Compile a schema supplied as a Stream. The resulting schema components are added to the cache. |
void |
Compile(System.Uri uri) Compile a schema, retrieving the source using a URI. The resulting schema components are added to the cache. |
void |
Compile(System.Xml.XmlReader ) Compile a schema, delivered using an XmlReader. The resulting schema components are added to the cache. |
void |
Compile(XdmNode )
Compile a schema document, located at an XdmNode. This may be a document node whose
child is an |
SchemaValidator |
NewSchemaValidator()
Create a new |
Property Detail |
---|
public SchemaResolver {get; set; }
The SchemaResolver is a user-supplied class used for resolving references to
schema documents. It applies to references from one schema document to another
appearing in xs:import
, xs:include
, and xs:redefine
; to
references from an instance document to a schema in xsi:schemaLocation
and
xsi:noNamespaceSchemaLocation
, to xsl:import-schema
in XSLT, and to
the import schema
declaration in XQuery.
public IList ErrorList {get; set; }
List of errors. The caller may supply an empty list before calling Compile; the processor will then populate the list with error information obtained during the schema compilation. Each error will be included as an object of type StaticError. If no error list is supplied by the caller, error information will be written to the standard error stream.
By supplying a custom List with a user-written add() method, it is possible to intercept error conditions as they occur.
Note that this error list is used only for errors detected during the compilation of the schema. It is not used for errors detected when using the schema to validate a source document.
Method Detail |
---|
public void Compile(System.IO.Stream input, System.Uri baseUri)
Compile a schema supplied as a Stream. The resulting schema components are added to the cache.
Parameters:input
-
baseUri
-
public void Compile(System.Uri uri)
Compile a schema, retrieving the source using a URI. The resulting schema components are added to the cache.
The document located via the URI is parsed using the System.Xml
parser.
uri
-
public void Compile(System.Xml.XmlReader )
Compile a schema, delivered using an XmlReader. The resulting schema components are added to the cache.
The XmlReader
is responsible for parsing the document; this method builds a tree
representation of the document (in an internal Saxon format) and compiles it.
If the XmlReader
is an XmlTextReader
, Saxon will set its Normalization
property to true, and will wrap it in a (non-validating) XmlValidatingReader
to ensure
that entity references are expanded.
public void Compile(XdmNode )
Compile a schema document, located at an XdmNode. This may be a document node whose
child is an xs:schema
element, or it may be
the xs:schema
element itself. The resulting schema components are added
to the cache.
public SchemaValidator NewSchemaValidator()
Create a new SchemaValidator
, which may be used for validating instance
documents.
The SchemaValidator
uses the cache of schema components held by the
SchemaManager
. It may also add new components to this cache (for example,
when the instance document references a schema using xsi:schemaLocation
).
It is also affected by changes to the schema cache that occur after the
SchemaValidator
is created.
When schema components are used for validating instance documents (or for compiling
schema-aware queries and stylesheets) they are sealed to prevent subsequent modification.
The modifications disallowed once a component is sealed include adding to the substitution group
of an element declaration, adding subtypes derived by extension to an existing complex type, and
use of <xs:redefine>