## Saxon.Api

Class DocumentBuilder

Class DomDestination

Class DynamicContext

Class DynamicError

Class EmptyEnumerator

Class ExtensionFunctionCall

Class ExtensionFunctionDefinition

Class NullDestination

Class Processor

Class QName

Class SchemaManager

Class SchemaValidator

Class Serializer

Class StaticContext

Class StaticError

Class TextWriterDestination

Class XPathCompiler

Class XPathExecutable

Class XPathSelector

Class XQueryCompiler

Class XQueryEvaluator

Class XQueryExecutable

Class XdmAnyFunctionType

Class XdmAnyItemType

Class XdmAnyNodeType

Class XdmAtomicType

Class XdmAtomicValue

Class XdmDestination

Class XdmEmptySequence

Class XdmFunctionItem

Class XdmItem

Class XdmItemType

Class XdmNode

Class XdmNodeKind

Class XdmSequenceType

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 IXdmEnumerator

Interface IXmlLocation

Interface SchemaResolver

## Saxon.Api
Class SchemaManager

    public class SchemaManager

implements object

  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
`String` | `XsdVersion` The version of the W3C XML Schema Specification handled by this SchemaManager
`SchemaResolver` | `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 `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.
`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 reader)` Compile a schema, delivered using an XmlReader. The resulting schema components are added to the cache.
`void` | `Compile(XdmNode node)` 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.
`SchemaValidator` | `NewSchemaValidator()` Create a new `SchemaValidator`, which may be used for validating instance documents.
`XdmAtomicType` | `GetAtomicType(QName qname)` Factory method to get an `AtomicType` object representing the atomic type with a given QName.

Property Detail

### XsdVersion

    public String XsdVersion {get; set; }

  The version of the W3C XML Schema Specification handled by this SchemaManager

  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.

### SchemaResolver

    public SchemaResolver 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.

### ErrorList

    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

### Compile

    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` -
    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 documents

### Compile

    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.

  Parameters:
  `uri` -
    The URI identifying the location where the schema document can be found

### Compile

    public void Compile(System.Xml.XmlReader reader)

  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. The `XmlReader` is used as supplied; it is the caller's responsibility to ensure that its settings are appropriate for parsing a schema document (for example, that entity references are expanded and whitespace is retained.)

  Parameters:
  `reader` -
    The XmlReader (that is, the XML parser) used to supply the source schema document

### Compile

    public void Compile(XdmNode node)

  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.

  Parameters:
  `node` -
    The document node or the outermost element node of a schema document.

### NewSchemaValidator

    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>`

### GetAtomicType

    public XdmAtomicType GetAtomicType(QName qname)

  Factory method to get an `AtomicType` object representing the atomic type with a given QName.

  It is undefined whether two calls on this method supplying the same QName will return the same `XdmAtomicType` object instance.

  Parameters:
  `qname` -
    The QName of the required type
  returns
    An `AtomicType` object representing this type if it is present in this schema (and is an atomic type); otherwise, null.