Saxon.Api An XsltCompiler object allows XSLT 2.0 stylesheets to be compiled. The compiler holds information that represents the static context for the compilation. To construct an XsltCompiler, use the factory method NewXsltCompiler on the Processor object. An XsltCompiler may be used repeatedly to compile multiple queries. Any changes made to the XsltCompiler (that is, to the static context) do not affect queries that have already been compiled. An XsltCompiler may be used concurrently in multiple threads, but it should not then be modified once initialized. Compile a stylesheet supplied as a Stream. Stream source = new FileStream("input.xsl", FileMode.Open, FileAccess.Read); XsltExecutable q = compiler.Compile(source); source.Close(); A stream containing the source text of the stylesheet An XsltExecutable which represents the compiled stylesheet object. The XsltExecutable may be loaded as many times as required, in the same or a different thread. The XsltExecutable is not affected by any changes made to the XsltCompiler once it has been compiled. If the stylesheet contains any xsl:include or xsl:import declarations, then the BaseURI property must be set to allow these to be resolved. The stylesheet is contained in the part of the input stream between its current position and the end of the stream. It is the caller's responsibility to close the input stream after use. If the compilation succeeded, then on exit the stream will be exhausted; if compilation failed, the current position of the stream on exit is undefined. Compile a stylesheet, retrieving the source using a URI. The document located via the URI is parsed using the System.Xml parser. This URI is used as the base URI of the stylesheet: the BaseUri property of the Compiler is ignored. The URI identifying the location where the stylesheet document can be found An XsltExecutable which represents the compiled stylesheet object. The XsltExecutable may be run as many times as required, in the same or a different thread. The XsltExecutable is not affected by any changes made to the XsltCompiler once it has been compiled. Compile a stylesheet, delivered using an XmlReader. 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. If the XmlReader has a BaseUri property, then that property determines the base URI of the stylesheet module, which is used when resolving any xsl:include or xsl:import declarations. If the XmlReader has no BaseUri property, then the BaseUri property of the Compiler is used instead. An ArgumentNullException is thrown if this property has not been supplied. An XsltExecutable which represents the compiled stylesheet object. The XsltExecutable may be run as many times as required, in the same or a different thread. The XsltExecutable is not affected by any changes made to the XsltCompiler once it has been compiled. Compile a stylesheet, located at an XdmNode. This may be a document node whose child is an xsl:stylesheet or xsl:transform element, or it may be the xsl:stylesheet or xsl:transform element itself. An XsltExecutable which represents the compiled stylesheet object. The XsltExecutable may be run as many times as required, in the same or a different thread. The XsltExecutable is not affected by any changes made to the XsltCompiler once it has been compiled. Locate and compile a stylesheet identified by an <?xml-stylesheet?> processing instruction within a source document. The document node of the source document containing the xml-stylesheet processing instruction. An XsltExecutable which represents the compiled stylesheet object. There are some limitations in the current implementation. The media type is ignored, as are the other parameters of the xml-stylesheet instruction. The href attribute must either reference an embedded stylesheet within the same document or a non-embedded external stylesheet. The base URI of the stylesheet, which forms part of the static context of the stylesheet. This is used for resolving any relative URIs appearing within the stylesheet, for example in xsl:include and xsl:import declarations, in schema locations defined to xsl:import-schema, or as an argument to the document() or doc() function. This base URI is used only if the input supplied to the Compile method does not provide its own base URI. It is therefore used on the version of the method that supplies input from a Stream. On the version that supplies input from an XmlReader, this base URI is used only if the XmlReader does not have its own base URI. An XmlResolver, which will be used to resolve URI references while compiling a stylesheet If no XmlResolver is set for the XsltCompiler, the XmlResolver is used that was set on the Processor at the time NewXsltCompiler was called. List of errors. The caller should supply an empty list before calling Compile; the processor will then populate the list with error information obtained during the 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. An XsltExecutable represents the compiled form of a stylesheet. To execute the stylesheet, it must first be loaded to form an XsltTransformer. An XsltExecutable is immutable, and therefore thread-safe. It is simplest to load a new XsltEvaluator each time the stylesheet is to be run. However, the XsltEvaluator is serially reusable within a single thread. An XsltExecutable is created by using one of the Compile methods on the XsltCompiler class. Load the stylesheet to prepare it for execution. An XsltTransformer. The returned XsltTransformer can be used to set up the dynamic context for stylesheet evaluation, and to run the stylesheet. An XsltTransformer represents a compiled and loaded stylesheet ready for execution. The XsltTransformer holds details of the dynamic evaluation context for the stylesheet. An XsltTransformer should not be used concurrently in multiple threads. It is safe, however, to reuse the object within a single thread to run the same stylesheet several times. Running the stylesheet does not change the context that has been established. An XsltTransformer is always constructed by running the Load method of an XsltExecutable. Set the value of a stylesheet parameter. The name of the parameter, expressed as a QName. If a parameter of this name has been declared in the stylesheet, the given value will be assigned to the variable. If the variable has not been declared, calling this method has no effect (it is not an error). The value to be given to the parameter. If the parameter declaration defines a required type for the variable, then this value will be converted in the same way as arguments to function calls (for example, numeric promotion is applied). Run the transformation, sending the result to a specified destination. The destination for the results of the stylesheet. The class XmlDestination is an abstraction that allows a number of different kinds of destination to be specified. Throws a DynamicError if the transformation fails. The initial context item for the stylesheet. This may be either a node or an atomic value. Most commonly it will be a document node, which might be constructed using the Build method of the DocumentBuilder object. The initial mode for the stylesheet. This is either a QName, for a named mode, or null, for the unnamed (default) mode. The initial template for the stylesheet. This is either a QName, for a named template, or null, if no initial template has been set. Setting this property to the name of a template that does not exist in the stylesheet throws a DynamicError with error code XTDE0040. Setting it to the name of a template that has template parameters throws a DynamicError with error code XTDE0060. The base output URI, which acts as the base URI for resolving the href attribute of xsl:result-document. The XmlResolver to be used at run-time to resolve and dereference URIs supplied to the doc() and document() functions. The IResultDocumentHandler to be used at run-time to process the output produced by any xsl:result-document instruction with an href attribute. In the absence of a user-supplied result document handler, the href attribute of the xsl:result-document instruction must be a valid relative URI, which is resolved against the value of the BaseOutputUri property, and the resulting absolute URI must identify a writable resource (typically a file in filestore, using the file: URI scheme). Escape hatch to the underlying Java implementation An IResultDocumentHandler can be nominated to handle output produced by the xsl:result-document instruction in an XSLT stylesheet. This interface affects any xsl:result-document instruction executed by the stylesheet, provided that it has an href attribute. If no IResultDocumentHandler is nominated (in the IResultDocumentHandler property of the XsltTransformer, the output of xsl:result-document is serialized, and is written to the file or other resource identified by the URI in the href attribute, resolved (if it is relative> against the URI supplied in the BaseOutputUri property of the XsltTransformer. If an IResultDocumentHandler is nominated, however, its HandleResultDocument method will be called whenever an xsl:result-document instruction with an href attribute is evaluated, and the generated result tree will be passed to the XmlDestination returned by that method. Handle output produced by the xsl:result-document instruction in an XSLT stylesheet. This method is called by the XSLT processor when an xsl:result-document with an href attribute is evaluated. An absolute or relative URI. This will be the effective value of the href attribute of the xsl:result-document in the stylesheet. The base URI that should be used for resolving the value of href if it is relative. This will always be the value of the BaseOutputUri property of the XsltTransformer. An XmlDestination to handle the result tree produced by the xsl:result-document instruction. The Close method of the returned XmlDestination will be called when the output is complete. The XSLT processor will ensure that the stylesheet cannot create two distinct result documents which are sent to the same URI. It is the responsibility of the IResultDocumentHandler to ensure that two distinct result documents are not set to the same XmlDestination. Failure to observe this rule can result in output streams being incorrectly closed. Note that more than one result document can be open at the same time, and that the order of opening, writing, and closing result documents chosen by the processor does not necessarily bear any direct resemblance to the way that the XSLT source code is written. An value in the XDM data model. A value is a sequence of zero or more items, each item being either an atomic value or a node. An XdmValue is immutable. A sequence consisting of a single item may be represented as an instance of XdmItem, which is a subtype of XdmValue. Create a value from a collection of items An enumerable collection providing the items to make up the sequence. Every member of this collection must be an instance of XdmItem Create an XdmValue from an underlying Saxon ValueRepresentation object. This method is provided for the benefit of applications that need to mix use of the Saxon .NET API with direct use of the underlying objects and methods offered by the Java implementation. An object representing an XDM value in the underlying Saxon implementation. An XdmValue that wraps the underlying Saxon value representation. Extract the underlying Saxon ValueRepresentation object from an XdmValue. This method is provided for the benefit of applications that need to mix use of the Saxon .NET API with direct use of the underlying objects and methods offered by the Java implementation. An object representing the XDM value in the underlying Saxon implementation. Get the sequence of items in the form of an IList The list of items making up this value. Each item in the list will be an object of type XdmItem Get the sequence of items in the form of an IEnumerator An enumeration over the list of items making up this value. Each item in the list will be an object of type XdmItem Get the number of items in the sequence The number of items in the sequence The class XdmItem represents an item in a sequence, as defined by the XDM data model. An item is either an atomic value or a node. An item is a member of a sequence, but it can also be considered as a sequence (of length one) in its own right. XdmItem is a subtype of XdmValue because every Item in the XDM data model is also a value. It cannot be assumed that every sequence of length one will be represented by an XdmItem. It is quite possible for an XdmValue that is not an XdmItem to hold a singleton sequence. Determine whether the item is an atomic value true if the item is an atomic value, false if it is a Node The class XdmAtomicValue represents an item in an XPath 2.0 sequence that is an atomic value. The value may belong to any of the 19 primitive types defined in XML Schema, or to a type derived from these primitive types, or to the XPath 2.0 type xdt:untypedAtomic Determine whether the item is an atomic value true (the item is an atomic value) Construct an atomic value of type xs:string The string value Construct an atomic value of type xs:integer The integer value Construct an atomic value of type xs:decimal The decimal value Construct an atomic value of type xs:float The float value Construct an atomic value of type xs:double The double value Construct an atomic value of type xs:boolean The boolean value Construct an atomic value of type xs:anyURI The uri value Construct an atomic value of type xs:QName The QName value Construct an atomic value of a given built-in or user-defined type AtomicValue("abcd", QName.XDT_UNTYPED_ATOMIC) creates an untyped atomic value containing the string "abcd" The string representation of the value (any value that is acceptable in the lexical space, as defined by XML Schema Part 2). Whitespace normalization as defined by the target type will be applied to the value. The QName giving the name of the target type. This must be an atomic type, and it must not be a type that is namespace-sensitive (QName, NOTATION, or types derived from these). If the type is a user-defined type then its definition must be present in the schema cache maintained by the SchemaManager. The Processor object. This is needed for looking up user-defined types, and also because some conversions are context-sensitive, for example they depend on the implicit timezone or the choice of XML 1.0 versus XML 1.1 for validating names. Thrown if the type is unknown or unsuitable, or if the supplied string is not a valid lexical representation of a value of the given type. Convert the atomic value to a string The value converted to a string, according to the rules of the XPath 2.0 cast operator Get the name of the value's XDM type The Processor object. This is needed for access to the NamePool, which maps the internal form of type names to their external form. The type of the value, as a QName. This may be a built-in type or a user-defined atomic type. Get the name of the primitive type of the value The primitive type of the value, as a QName. This will be the name of one of the primitive types defined in XML Schema Part 2, or the XPath-defined type xdt:untypedAtomic. For the purposes of this method, xs:integer is considered to be a primitive type. Get the value as a CLI object of the nearest equivalent type. The return type is as follows: xs:string - String xs:integer - Long xs:decimal - Decimal xs:double - Double xs:float - Float xs:boolean - Bool xs:QName - QName xs:anyURI - Uri xdt:untypedAtomic - String Other types - currently String, but this may change in the future The value converted to the most appropriate CLI type The class XdmNode represents a Node in the XDM Data Model. A Node is an XdmItem, and is therefore an XdmValue in its own right, and may also participate as one item within a sequence value. An XdmNode is implemented as a wrapper around an object of type net.sf.saxon.NodeInfo. Because this is a key interface within Saxon, it is exposed via this API, even though it is a Java interface that is not part of the API proper. The XdmNode interface exposes basic properties of the node, such as its name, its string value, and its typed value. Navigation to other nodes is supported through a single method, EnumerateAxis, which allows other nodes to be retrieved by following any of the XPath axes. Determine whether the item is an atomic value false (the item is not an atomic value) Get a the string value of a named attribute of this element. Returns null if this node is not an element, or if this element has no attribute with the specified name. Get an enumerator that supplies all the nodes on one of the XPath axes, starting with this node. The axis to be navigated, for example XdmAxis.Child for the child axis. The nodes are returned in axis order: that is, document order for a forwards axis, reverse document order for a reverse axis. Get an enumerator that selects all the nodes on one of the XPath axes, provided they have a given name. The nodes selected are those of the principal node kind (elements for most axes, attributes for the attribute axis, namespace nodes for the namespace axis) whose name matches the name given in the second argument. The axis to be navigated, for example XdmAxis.Child for the child axis. The name of the required nodes, for example new QName("", "item") to select nodes with local name "item", in no namespace. The nodes are returned in axis order: that is, document order for a forwards axis, reverse document order for a reverse axis. Send the node (that is, the subtree rooted at this node) to an XmlTextWriter Note that a XmlTextWriter can only handle a well-formed XML document. This method will therefore signal an exception if the node is a document node with no children, or with more than one element child. Return a string representation of the node. This currently returns the same as the OuterXml property. To get the string value as defined in XPath, use the StringValue property. The name of the node, as a QName. Returns null in the case of unnamed nodes. The kind of node, as an instance of System.Xml.XmlNodeType. For a namespace node in the XDM model, the value XmlNodeType.None is returned. The typed value of the node, as an instance of XdmValue. A DynamicError is thrown if the node has no typed value, as will be the case for an element with element-only content. The string value of the node. Get the parent of this node. Returns either a document node, and element node, or null in the case where this node has no parent. The Base URI of the node. Return a serialization of this node as lexical XML In the case of an element node, the result will be a well-formed XML document serialized as defined in the W3C XSLT/XQuery serialization specification, using options method="xml", indent="yes", omit-xml-declaration="yes". In the case of a document node, the result will be a well-formed XML document provided that the document node contains exactly one element child, and no text node children. In other cases it will be a well-formed external general parsed entity. In the case of an attribute node, the output is a string in the form name="value". The name will use the original namespace prefix. Other nodes, such as text nodes, comments, and processing instructions, are represented as they would appear in lexical XML. Escape hatch to the underlying class in the Java implementation The class XdmEmptySequence represents an empty sequence in the XDM Data Model. An empty sequence may also be represented by an XdmValue whose length happens to be zero. Applications should therefore not test to see whether an object is an instance of this class in order to decide whether it is empty. In interfaces that expect an XdmItem, an empty sequence is represented by a CLI null value. The singular instance of this class The QName class represents an instance of xs:QName, as defined in the XPath 2.0 data model. Internally, it has three components, a namespace URI, a local name, and a prefix. The prefix is intended to be used only when converting the value back to a string. Note that a QName is not itself an XdmItem in this model; however it can be wrapped in an XdmItem. QName constant for the name xs:string QName constant for the name xs:integer QName constant for the name xs:double QName constant for the name xs:float QName constant for the name xs:decimal QName constant for the name xs:boolean QName constant for the name xs:anyURI QName constant for the name xs:QName QName constant for the name xs:untypedAtomic QName constant for the name xs:untypedAtomic (for backwards compatibility) Construct a QName using a namespace URI and a lexical representation. The lexical representation may be a local name on its own, or it may be in the form prefix:local-name This constructor does not check that the components of the QName are lexically valid. The namespace URI. Use either the string "" or null for names that are not in any namespace. Either the local part of the name, or the prefix and local part in the format prefix:local Construct a QName using a namespace prefix, a namespace URI, and a local name (in that order). This constructor does not check that the components of the QName are lexically valid. The prefix of the name. Use either the string "" or null for names that have no prefix (that is, they are in the default namespace) The namespace URI. Use either the string "" or null for names that are not in any namespace. The local part of the name Construct a QName from a lexical QName, supplying an element node whose in-scope namespaces are to be used to resolve any prefix contained in the QName. This constructor checks that the components of the QName are lexically valid. If the lexical QName has no prefix, the name is considered to be in the default namespace, as defined by xmlns="...". If the prefix of the lexical QName is not in scope, returns null. The lexical QName, in the form prefix:local or simply local. The element node whose in-scope namespaces are to be used to resolve the prefix part of the lexical QName. If the prefix of the lexical QName is not in scope If the lexical QName is invalid (for example, if it contains invalid characters) Construct a QName from an XmlQualifiedName (as defined in the System.Xml package). Note that an XmlQualifiedName does not contain any prefix, so the result will always have a prefix of "" The XmlQualifiedName Factory method to construct a QName from a string containing the expanded QName in Clark notation, that is, {uri}local The prefix part of the QName will be set to an empty string. The URI in Clark notation: {uri}local if the name is in a namespace, or simply local if not. Register a QName with the Processor. This makes comparison faster when the QName is compared with others that are also registered with the Processor. The Processor in which the name is to be registered. Validate the QName against the XML 1.0 or XML 1.1 rules for valid names. The Processor in which the name is to be validated. This determines whether the XML 1.0 or XML 1.1 rules for forming names are used. true if the name is valid, false if not Convert the value to a string. The resulting string is the lexical form of the QName, using the original prefix if there was one. Get a hash code for the QName, to support equality matching. This supports the semantics of equality, which considers only the namespace URI and local name, and not the prefix. The algorithm for allocating a hash code does not depend on registering the QName with the Processor. Test whether two QNames are equal. This supports the semantics of equality, which considers only the namespace URI and local name, and not the prefix. The result of the function does not depend on registering the QName with the Processor, but is computed more quickly if the QNames have both been registered Convert the value to an XmlQualifiedName (as defined in the System.Xml package) Note that this loses the prefix. Convert to a net.sf.saxon.value.QNameValue The prefix of the QName. This plays no role in operations such as comparison of QNames for equality, but is retained (as specified in XPath) so that a string representation can be reconstructed. Returns the zero-length string in the case of a QName that has no prefix. The namespace URI of the QName. Returns "" (the zero-length string) if the QName is not in a namespace. The local part of the QName The expanded name, as a string using the notation devised by James Clark. If the name is in a namespace, the resulting string takes the form {uri}local. Otherwise, the value is the local part of the name. This class represents an enumeration of the values in an XPath sequence. It implements the IEnumerator interface, and the objects returned are always instances of XPathItem Because the underlying value can be evaluated lazily, it is possible for exceptions to occur as the sequence is being read. Move to the next item in the sequence true if there are more items in the sequence Reset the enumeration so that the next call of MoveNext will position the enumeration at the first item in the sequence Return the current item in the sequence An object which will always be an instance of XdmItem Enumeration identifying the thirteen XPath axes The XPath ancestor axis The XPath ancestor-or-self axis The XPath attribute axis The XPath child axis The XPath descendant axis The XPath descandant-or-self axis The XPath following axis The XPath following-sibling axis The XPath namespace axis The XPath parent axis The XPath preceding axis The XPath preceding-sibling axis The XPath self axis The StaticError class contains information about a static error detected during compilation of a stylesheet, query, or XPath expression. Create a new StaticError, wrapping a Saxon XPathException Return the error message. The error code, as a QName. May be null if no error code has been assigned Return the message associated with this error The URI of the query or stylesheet module in which the error was detected (as a string) May be null if the location of the error is unknown, or if the error is not localized to a specific module, or if the module in question has no known URI (for example, if it was supplied as an anonymous Stream) The line number locating the error within a query or stylesheet module May be set to -1 if the location of the error is unknown Indicate whether this error is being reported as a warning condition. If so, applications may ignore the condition, though the results may not be as intended. Indicate whether this condition is a type error. The DynamicError class contains information about a dynamic error detected during execution of a stylesheet, query, or XPath expression. Create a new DynamicError, specifying the error message Create a new DynamicError, wrapping a Saxon XPathException Return the error message. The error code, as a QName. May be null if no error code has been assigned Return the message associated with this error The URI of the query or stylesheet module in which the error was detected (as a string) May be null if the location of the error is unknown, or if the error is not localized to a specific module, or if the module in question has no known URI (for example, if it was supplied as an anonymous Stream) The line number locating the error within a query or stylesheet module May be set to -1 if the location of the error is unknown Indicate whether this error is being reported as a warning condition. If so, applications may ignore the condition, though the results may not be as intended. Indicate whether this condition is a type error. An XQueryCompiler object allows XQuery queries to be compiled. To construct an XQueryCompiler, use the factory method newXQueryCompiler on the Processor object. The XQueryCompiler holds information that represents the static context for the queries that it compiles. This information remains intact after performing a compilation. An XQueryCompiler may therefore be used repeatedly to compile multiple queries. Any changes made to the XQueryCompiler (that is, to the static context) do not affect queries that have already been compiled. An XQueryCompiler may be used concurrently in multiple threads, but it should not then be modified once initialized. Declare a namespace for use by the query. This has the same status as a namespace appearing within the query prolog (though a declaration in the query prolog of the same prefix will take precedence) The namespace prefix to be declared. Use a zero-length string to declare the default namespace (that is, the default namespace for elements and types). The namespace URI. It is possible to specify a zero-length string to "undeclare" a namespace. Compile a query supplied as a Stream. The XQuery processor attempts to deduce the encoding of the query by looking for a byte-order-mark, or if none is present, by looking for the encoding declaration in the XQuery version declaration. For this to work, the stream must have the CanSeek property. If no encoding information is present, UTF-8 is assumed. The base URI of the query is set to the value of the BaseUri property. If this has not been set, then the base URI will be undefined, which means that any use of an expression that depends on the base URI will cause an error. XQueryExecutable q = compiler.Compile(new FileStream("input.xq", FileMode.Open, FileAccess.Read)); A stream containing the source text of the query An XQueryExecutable which represents the compiled query object. The XQueryExecutable may be run as many times as required, in the same or a different thread. The XQueryExecutable is not affected by any changes made to the XQueryCompiler once it has been compiled. Throws a StaticError if errors were detected during static analysis of the query. Details of the errors will be added as StaticError objects to the ErrorList if supplied; otherwise they will be written to the standard error stream. The exception that is returned is merely a summary indicating the status. Compile a query supplied as a String. Using this method the query processor is provided with a string of Unicode characters, so no decoding is necessary. Any encoding information present in the version declaration is therefore ignored. XQueryExecutable q = compiler.Compile("distinct-values(//*/node-name()"); A string containing the source text of the query An XQueryExecutable which represents the compiled query object. The XQueryExecutable may be run as many times as required, in the same or a different thread. The XQueryExecutable is not affected by any changes made to the XQueryCompiler once it has been compiled. Throws a StaticError if errors were detected during static analysis of the query. Details of the errors will be added as StaticError objects to the ErrorList if supplied; otherwise they will be written to the standard error stream. The exception that is returned is merely a summary indicating the status. The base URI of the query, which forms part of the static context of the query. This is used for resolving any relative URIs appearing within the query, for example in references to library modules, schema locations, or as an argument to the doc() function. A user-supplied IQueryResolver used to resolve location hints appearing in an import module declaration. In the absence of a user-supplied QueryResolver, an import module declaration is interpreted as follows. First, if the module URI identifies an already loaded module, that module is used and the location hints are ignored. Otherwise, each URI listed in the location hints is resolved using the XmlResolver registered with the Processor. List of errors. The caller should supply an empty list before calling Compile; the processor will then populate the list with error information obtained during the 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. Escape hatch to the underying Java implementation An XQueryExecutable represents the compiled form of a query. To execute the query, it must first be loaded to form an XQueryEvaluator. An XQueryExecutable is immutable, and therefore thread-safe. It is simplest to load a new XQueryEvaluator each time the query is to be run. However, the XQueryEvaluator is serially reusable within a single thread. An XQueryExecutable is created by using one of the Compile methods on the XQueryCompiler class. Load the query to prepare it for execution. An XQueryEvaluator. The returned XQueryEvaluator can be used to set up the dynamic context for query evaluation, and to run the query. An XQueryEvaluator represents a compiled and loaded query ready for execution. The XQueryEvaluator holds details of the dynamic evaluation context for the query. An XQueryEvaluator should not be used concurrently in multiple threads. It is safe, however, to reuse the object within a single thread to run the same query several times. Running the query does not change the context that has been established. An XQueryEvaluator is always constructed by running the Load method of an XQueryExecutable. Set the value of an external variable declared in the query. The name of the external variable, expressed as a QName. If an external variable of this name has been declared in the query prolog, the given value will be assigned to the variable. If the variable has not been declared, calling this method has no effect (it is not an error). The value to be given to the external variable. If the variable declaration defines a required type for the variable, then this value must match the required type: no conversions are applied. Evaluate the query, returning the result as an XdmValue (that is, a sequence of nodes and/or atomic values). An XdmValue representing the results of the query Throws a DynamicError if any run-time failure occurs while evaluating the query. Evaluate the query, returning the result as an XdmItem (that is, a single node or atomic value). An XdmItem representing the result of the query, or null if the query returns an empty sequence. If the query returns a sequence of more than one item, any items after the first are ignored. Throws a DynamicError if any run-time failure occurs while evaluating the expression. Evaluate the query, returning the result as an IEnumerator (that is, an enumerator over a sequence of nodes and/or atomic values). An enumerator over the sequence that represents the results of the query. Each object in this sequence will be an instance of XdmItem. Note that the query may be evaluated lazily, which means that a successful response from this method does not imply that the query has executed successfully: failures may be reported later while retrieving items from the iterator. Throws a DynamicError if any run-time failure occurs while evaluating the expression. Evaluate the query, sending the result to a specified destination. The destination for the results of the query. The class XmlDestination is an abstraction that allows a number of different kinds of destination to be specified. Throws a DynamicError if any run-time failure occurs while evaluating the expression. The context item for the query. This may be either a node or an atomic value. Most commonly it will be a document node, which might be constructed using the LoadDocument method of the Processor object. The XmlResolver to be used at run-time to resolve and dereference URIs supplied to the doc() function. Interface defining a user-supplied class used to retrieve XQUery library modules listed in an import module declaration in the query prolog. Given a module URI and a set of location hints, return a set of query modules. The URI of the required library module as written in the import module declaration The base URI of the module containing the import module declaration The sequence of URIs (if any) listed as location hints in the import module declaration in the query prolog. A set of absolute Uris identifying the query modules to be loaded. There is no requirement that these correspond one-to-one with the URIs defined in the locationHints. The returned URIs will be dereferenced by calling the GetEntity method. Dereference a URI returned by GetModules to retrieve a Stream containing the actual query text. A URI returned by the GetModules method. Either a Stream or a String containing the query text. The supplied URI will be used as the base URI of the query module. An XPathCompiler object allows XPath queries to be compiled. The compiler holds information that represents the static context for the expression. To construct an XPathCompiler, use the factory method newXPathCompiler on the Processor object. An XPathCompiler may be used repeatedly to compile multiple queries. Any changes made to the XPathCompiler (that is, to the static context) do not affect queries that have already been compiled. An XPathCompiler may be used concurrently in multiple threads, but it should not then be modified once initialized. Declare a namespace for use by the XPath expression. The namespace prefix to be declared. Use a zero-length string to declare the default namespace (that is, the default namespace for elements and types). The namespace URI. It is possible to specify a zero-length string to "undeclare" a namespace. Declare a variable for use by the XPath expression. If the expression refers to any variables, then they must be declared here. The name of the variable, as a QName Compile an expression supplied as a String. XPathExecutable q = compiler.Compile("distinct-values(//*/node-name()"); A string containing the source text of the XPath expression An XPathExecutable which represents the compiled xpath expression object. The XPathExecutable may be run as many times as required, in the same or a different thread. The XPathExecutable is not affected by any changes made to the XPathCompiler once it has been compiled. The base URI of the expression, which forms part of the static context of the expression. This is used for resolving any relative URIs appearing within the expression, for example in references to library modules, schema locations, or as an argument to the doc() function. XPath 1.0 Backwards Compatibility Mode. If true, backwards compatibility mode is set. In backwards compatibility mode, more implicit type conversions are allowed in XPath expressions, for example it is possible to compare a number with a string. The default is false (backwards compatibility mode is off). An XPathExecutable represents the compiled form of an XPath expression. To evaluate the expression, it must first be loaded to form an XPathSelector. An XPathExecutable is immutable, and therefore thread-safe. It is simplest to load a new XPathSelector each time the expression is to be evaluated. However, the XPathSelector is serially reusable within a single thread. An XPathExecutable is created by using one of the Compile methods on the XPathCompiler class. Load the compiled XPath expression to prepare it for execution. An XPathSelector. The returned XPathSelector can be used to set up the dynamic context, and then to evaluate the expression. An XPathSelector represents a compiled and loaded XPath expression ready for execution. The XPathSelector holds details of the dynamic evaluation context for the XPath expression. An XPathSelector should not be used concurrently in multiple threads. It is safe, however, to reuse the object within a single thread to evaluate the same XPath expression several times. Evaluating the expression does not change the context that has been established. An XPathSelector is always constructed by running the Load method of an XPathExecutable. Set the value of a variable The name of the variable. This must match the name of a variable that was declared to the XPathCompiler. No error occurs if the expression does not actually reference a variable with this name. The value to be given to the variable. Evaluate the expression, returning the result as an XdmValue (that is, a sequence of nodes and/or atomic values). Although a singleton result may be represented as an XdmItem, there is no guarantee that this will always be the case. If you know that the expression will return at most one node or atomic value, it is best to use the EvaluateSingle method, which does guarantee that an XdmItem (or null) will be returned. An XdmValue representing the results of the expression. Evaluate the XPath expression, returning the result as an XdmItem (that is, a single node or atomic value). An XdmItem representing the result of the expression, or null if the expression returns an empty sequence. If the expression returns a sequence of more than one item, any items after the first are ignored. Evaluate the expression, returning the result as an IEnumerator (that is, an enumerator over a sequence of nodes and/or atomic values). An enumerator over the sequence that represents the results of the expression. Each object in this sequence will be an instance of XdmItem. Note that the expression may be evaluated lazily, which means that a successful response from this method does not imply that the expression has executed successfully: failures may be reported later while retrieving items from the iterator. The context item for the XPath expression evaluation. This may be either a node or an atomic value. Most commonly it will be a document node, which might be constructed using the Build method of the DocumentBuilder object. An abstract destination for the results of a query or transformation Note to implementors: To implement a new kind of destination, you need to supply a method getResult which returns an implementation of the JAXP Result interface. Optionally, if the destination performs serialization, you can also implement getOutputProperties, which returns the properties used for serialization. Get a Result to which the XML document can be sent as a series of events. This must be an implementation of the JAXP Result interface that is recognized by Saxon. Get a set of Properties representing the parameters to the serializer. The default implementation returns an empty set of properties. Close the Destination, releasing any resources that need to be released. This method is called by the system on completion of a query or transformation. Some kinds of Destination may need to close an output stream, others might not need to do anything. The default implementation does nothing. A Serializer takes a tree representation of XML and turns it into lexical XML markup. Note that this is serialization in the sense of the W3C XSLT and XQuery specifications. Unlike the class System.Xml.Serialization.XmlSerializer, this object does not serialize arbitrary CLI objects. QName identifying the serialization parameter "method". If the method is a user-defined method, then it is given as a QName in Clark notation, that is "{uri}local". QName identifying the serialization parameter "byte-order-mark" QName identifying the serialization parameter "cdata-section-elements". The value of this parameter is given as a space-separated list of expanded QNames in Clark notation, that is "{uri}local". QName identifying the serialization parameter "doctype-public" QName identifying the serialization parameter "doctype-system" QName identifying the serialization parameter "encoding" QName identifying the serialization parameter "escape-uri-attributes". The value is the string "yes" or "no". QName identifying the serialization parameter "include-content-type". The value is the string "yes" or "no". QName identifying the serialization parameter "indent". The value is the string "yes" or "no". QName identifying the serialization parameter "media-type". QName identifying the serialization parameter "normalization-form" QName identifying the serialization parameter "omit-xml-declaration". The value is the string "yes" or "no". QName identifying the serialization parameter "standalone". The value is the string "yes" or "no" or "omit". QName identifying the serialization parameter "undeclare-prefixes". The value is the string "yes" or "no". QName identifying the serialization parameter "use-character-maps". This is available only with XSLT. The value of the parameter is a list of expanded QNames in Clark notation giving the names of character maps defined in the XSLT stylesheet. QName identifying the serialization parameter "version" QName identifying the serialization parameter "saxon:character-representation" QName identifying the serialization parameter "saxon:indent-spaces". The value is an integer (represented as a string) indicating the amount of indentation required. If specified, this parameter overrides indent="no". QName identifying the serialization parameter "saxon:next-in-chain". This is available only with XSLT, and identifies the URI of a stylesheet that is to be used to process the results before passing them to their final destination. QName identifying the serialization parameter "require-well-formed". The value is the string "yes" or "no". If set to "yes", the output must be a well-formed document, or an error will be reported. Create a Serializer Set a serialization property In the case of XSLT, properties set within the serializer override any properties set in xsl:output declarations in the stylesheet. Similarly, with XQuery, they override any properties set in the Query prolog using declare option saxon:output. Serializer qout = new Serializer(); qout.SetOutputProperty(Serializer.METHOD, "xml"); qout.SetOutputProperty(Serializer.INDENT, "yes"); qout.SetOutputProperty(Serializer.SAXON_INDENT_SPACES, "1"); The name of the serialization property to be set The value to be set for the serialization property. May be null to unset the property (that is, to set it back to the default value). Specify the destination of the serialized output, in the form of a file name The name of the file to receive the serialized output Throws a DyamicError if it is not possible to create an output stream to write to this file, for example, if the filename is in a directory that does not exist. Specify the destination of the serialized output, in the form of a Stream The stream to which the output will be written. This must be a stream that allows writing. Specify the destination of the serialized output, in the form of a TextWriter Note that when writing to a TextWriter, character encoding is the responsibility of the TextWriter, not the Serializer. This means that the encoding requested in the output properties is ignored; it also means that characters that cannot be represented in the target encoding will use whatever fallback representation the TextWriter defines, rather than being represented as XML character references. The stream to which the output will be written. This must be a stream that allows writing. A DomDestination represents an XmlDocument that is constructed to hold the output of a query or transformation. No data needs to be supplied to the DomDestination object. The query or transformation populates an XmlDocument, which may then be retrieved as the value of the XmlDocument property Construct a DomDestination After construction, retrieve the constructed document node A TextWriterDestination is an implementation of XmlDestination that wraps an instance of XmlTextWriter. Note that when a TextWriterDestination is used to process the output of a stylesheet or query, the output format depends only on the way the underlying TextWriter is configured; serialization parameters present in the stylesheet or query are ignored. Construct a TextWriterDestination The XmlTextWriter that is to be notified of the events representing the XML document. An XdmDestination represents an XdmNode that is constructed to hold the output of a query or transformation: that is, a tree using Saxon's implementation of the XDM data model No data needs to be supplied to the XdmDestination object. The query or transformation populates an XmlNode, which may then be retrieved as the value of the XmlNode property. An XdmDestination can be reused to hold the results of a second transformation only if the reset method is first called to reset its state. Construct a DomDestination Reset the state of the XdmDestination so that it can be used to hold the result of another transformation. After construction, retrieve the constructed document node The Processor class serves three purposes: it allows global Saxon configuration options to be set; it acts as a factory for generating XQuery, XPath, and XSLT compilers; and it owns certain shared resources such as the Saxon NamePool and compiled schemas. This is the first object that a Saxon application should create. Once established, a Processor may be used in multiple threads. Create a new Processor Create a Processor, indicating whether it is to be schema-aware. Set to true if the Processor is to be schema-aware. This requires the Saxon-SA product to be installed, with a valid license key. Create a Processor, indicating whether it is to be schema-aware. Set to true if the Processor is to be schema-aware. This requires the Saxon-SA product to be installed, with a valid license key. This option has no effect at this release. Create a new DocumentBuilder, which may be used to build XDM documents from a variety of sources. A new DocumentBuilder Create a new XQueryCompiler, which may be used to compile XQuery queries. The returned XQueryCompiler retains a live link to the Processor, and may be affected by subsequent changes to the Processor. A new XQueryCompiler Create a new XsltCompiler, which may be used to compile XSLT stylesheets. The returned XsltCompiler retains a live link to the Processor, and may be affected by subsequent changes to the Processor. A new XsltCompiler Create a new XPathCompiler, which may be used to compile XPath expressions. The returned XPathCompiler retains a live link to the Processor, and may be affected by subsequent changes to the Processor. A new XPathCompiler Register a named collection. A collection is identified by a URI (the collection URI), and its content is represented by an IEnumerable that enumerates the contents of the collection. The values delivered by this enumeration are Uri values, which can be mapped to nodes using the registered XmlResolver. The URI used to identify the collection in a call of the XPath collection() function. The default collection is registered by supplying null as the value of this argument (this is the collection returned when the XPath collection() function is called with no arguments). An enumerable object that represents the contents of the collection, as a sequence of document URIs. The enumerator returned by this IEnumerable object must return instances of the Uri class. Collections should be stable: that is, two calls to retrieve the same collection URI should return the same sequence of document URIs. This requirement is imposed by the W3C specifications, but in the case of a user-defined collection it is not enforced by the Saxon product. A collection may be "unregistered" by providing null as the value of the contents argument. A collection may be replaced by specifying the URI of an existing collection. Collections registered with a processor are available to all queries and stylesheets running under the control that processor. Collections should not normally be registered while queries and transformations are in progress. Get the full name of the Saxon product version implemented by this Processor Get the Saxon product version number (for example, "8.8.1") Indicates whether the Processor is schema-aware Gets the SchemaManager for the Processor. Returns null if the Processor is not schema-aware. An XmlResolver, which will be used while compiling and running queries, XPath expressions, and stylesheets, if no other XmlResolver is nominated By default an XmlUrlResolver is used. This means that the responsibility for resolving and dereferencing URIs rests with the .NET platform, not with the GNU Classpath. When Saxon invokes a user-written XmlResolver, the GetEntity method may return any of: a System.IO.Stream; a System.IO.TextReader; or a java.xml.transform.Source. The XML version used in this Processor (for example, this determines what characters are permitted in a name) The value must be 1.0 or 1.1, as a decimal. The default version is currently 1.0, but may change in the future. The underlying Configuration object in the Saxon implementation This property provides access to internal methods in the Saxon engine that are not specifically exposed in the .NET API. In general these methods should be considered to be less stable than the classes in the Saxon.Api namespace. The internal methods follow Java naming conventions rather than .NET conventions. Information about the returned object (and the objects it provides access to) is included in the Saxon JavaDoc docmentation, available online. The DocumentBuilder class enables XDM documents to be built from various sources. The class is always instantiated using the NewDocumentBuilder method on the Processor object. Load an XML document, retrieving it via a URI. Note that the type Uri requires an absolute URI. The URI is dereferenced using the registered XmlResolver. This method takes no account of any fragment part in the URI. The role passed to the GetEntity method of the XmlResolver is "application/xml", and the required return type is System.IO.Stream. The document located via the URI is parsed using the System.Xml parser. Note that the Microsoft System.Xml parser does not report whether attributes are defined in the DTD as being of type ID and IDREF. This is true whether or not DTD-based validation is enabled. This means that such attributes are not accessible to the id() and idref() functions. The URI identifying the location where the document can be found. This will also be used as the base URI of the document (regardless of the setting of the BaseUri property). An XdmNode. This will be the document node at the root of the tree of the resulting in-memory document. Load an XML document supplied as raw (lexical) XML on a Stream. The document is parsed using the System.Xml parser. Before calling this method, the BaseUri property must be set to identify the base URI of this document, used for resolving any relative URIs contained within it. Note that the Microsoft System.Xml parser does not report whether attributes are defined in the DTD as being of type ID and IDREF. This is true whether or not DTD-based validation is enabled. This means that such attributes are not accessible to the id() and idref() functions. The Stream containing the XML source to be parsed An XdmNode, the document node at the root of the tree of the resulting in-memory document Load an XML document, delivered using an XmlReader. The XmlReader is responsible for parsing the document; this method builds a tree representation of the document (in an internal Saxon format) and returns its document node. The XmlReader is not required to perform validation but it must expand any entity references. Saxon uses the properties of the XmlReader as supplied. Use of a plain XmlTextReader is discouraged, because it does not expand entity references. This should only be used if you know in advance that the document will contain no entity references (or perhaps if your query or stylesheet is not interested in the content of text and attribute nodes). Instead, with .NET 1.1 use an XmlValidatingReader (with ValidationType set to None). The constructor for XmlValidatingReader is obsolete in .NET 2.0, but the same effect can be achieved by using the Create method of XmlReader with appropriate XmlReaderSettings Conformance with the W3C specifications requires that the Normalization property of an XmlTextReader should be set to true. However, Saxon does not insist on this. If the XmlReader performs schema validation, Saxon will ignore any resulting type information. Type information can only be obtained by using Saxon's own schema validator, which will be run if the SchemaValidationMode property is set to Strict or Lax Note that the Microsoft System.Xml parser does not report whether attributes are defined in the DTD as being of type ID and IDREF. This is true whether or not DTD-based validation is enabled. This means that such attributes are not accessible to the id() and idref() functions. The XMLReader that supplies the parsed XML source An XdmNode, the document node at the root of the tree of the resulting in-memory document Load an XML DOM document, supplied as an XmlNode, into a Saxon XdmNode. The returned document will contain only the subtree rooted at the supplied node. This method copies the DOM tree to create a Saxon tree. See the Wrap method for an alternative that creates a wrapper the DOM tree, allowing it to be modified in situ. The DOM Node to be copied to form a Saxon tree An XdmNode, the document node at the root of the tree of the resulting in-memory document Wrap an XML DOM document, supplied as an XmlNode, as a Saxon XdmNode. This method must be applied at the level of the Document Node. Unlike the Build method, the original DOM is not copied. This saves memory and time, but it also means that it is not possible to perform operations such as whitespace stripping and schema validation. The DOM document node to be wrapped An XdmNode, the Saxon document node at the root of the tree of the resulting in-memory document An XmlResolver, which will be used to resolve URIs of documents being loaded and of references to external entities within those documents. By default an XmlUrlResolver is used. This means that the responsibility for resolving and dereferencing URIs rests with the .NET platform (and not with the GNU Classpath). When Saxon invokes a user-written XmlResolver, the GetEntity method may return any of: a System.IO.Stream; a System.IO.TextReader; or a java.xml.transform.Source. Determines whether line numbering is enabled for documents loaded using this DocumentBuilder. By default, line numbering is disabled. Line numbering is not available for all kinds of source: in particular, it is not available when loading from an existing XmlDocument. The resulting line numbers are accessible to applications using the extension function saxon:line-number() applied to a node. Line numbers are maintained only for element nodes; the line number returned for any other node will be that of the most recent element. Determines whether schema validation is applied to documents loaded using this DocumentBuilder, and if so, whether it is strict or lax. By default, no schema validation takes place. This option requires the schema-aware version of the Saxon product (Saxon-SA). Determines whether DTD validation is applied to documents loaded using this DocumentBuilder. By default, no DTD validation takes place. Determines the whitespace stripping policy applied when loading a document using this DocumentBuilder. By default, whitespace text nodes appearing in element-only content are stripped, and all other whitespace text nodes are retained. The base URI of a document loaded using this DocumentBuilder. This is used for resolving any relative URIs appearing within the document, for example in references to DTDs and external entities. This information is required when the document is loaded from a source that does not provide an intrinsic URI, notably when loading from a Stream or a TextReader. Enumeration identifying the various Schema validation modes No validation Strict validation Lax validation Enumeration identifying the various Whitespace stripping policies No whitespace is stripped Whitespace text nodes appearing in element-only content are stripped All whitespace text nodes are stripped 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> Compile a schema supplied as a Stream. The resulting schema components are added to the cache. A stream containing the source text of the schema The base URI of the schema document, for resolving any references to other schema documents 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. The URI identifying the location where the schema document can be found 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. 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. 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> 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. 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. A SchemaValidator is an object that is used for validating instance documents against a schema. The schema consists of the collection of schema components that are available within the schema cache maintained by the SchemaManager, together with any additional schema components located during the course of validation by means of an xsl:schemaLocation or xsi:noNamespaceSchemaLocation attribute within the instance document. If validation fails, an exception is thrown. If validation succeeds, the validated document can optionally be written to a specified destination. This will be a copy of the original document, augmented with default values for absent elements and attributes, and carrying type annotations derived from the schema processing. Saxon does not deliver the full PSVI as described in the XML schema specifications, only the subset of the PSVI properties featured in the XDM data model. Supply the instance document to be validated in the form of a Stream A stream containing the XML document to be parsed and validated. The base URI to be used for resolving any relative references, for example a reference to an xsi:schemaLocation Supply the instance document to be validated in the form of a Uri reference The supplied node must be either a document node or an element node. If an element node is supplied, then the subtree rooted at this element is validated as if it were a complete document: that is, it must not only conform to the structure required of that element, but any referential constraints (keyref, IDREF) must be satisfied within that subtree. URI of the document to be validated Supply the instance document to be validated, in the form of an XmlReader. The XmlReader is responsible for parsing the document; this method validates it. The XmlReader used to read and parse the instance document being validated. This is used as supplied. For conformance, use of a plain XmlTextReader is discouraged, because it does not expand entity references. This may cause validation failures. Supply the instance document to be validated in the form of an XdmNode The supplied node must be either a document node or an element node. If an element node is supplied, then the subtree rooted at this element is validated as if it were a complete document: that is, it must not only conform to the structure required of that element, but any referential constraints (keyref, IDREF) must be satisfied within that subtree. The document or element node at the root of the tree to be validated Supply the destination to hold the validated document. If no destination is supplied, the validated document is discarded. The destination differs from the source in that (a) default values of missing elements and attributes are supplied, and (b) the typed values of elements and attributes are available. However, typed values can only be accessed if the result is represented using the XDM data model, that is, if the destination is supplied as an XdmDestination. Run the validation of the supplied source document, optionally writing the validated document to the supplied destination. The validation mode may be either strict or lax. The default is strict; this property is set to indicate that lax validation is required. With strict validation, validation fails if no element declaration can be located for the outermost element. With lax validation, the absence of an element declaration results in the content being considered valid. 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 while using the schema to validate a source document. It is not used to report errors in the schema itself. 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. Given a targetNamespace and a set of location hints, return a set of schema documents. The target namespace of the required schema components The base URI of the module containing the reference to a schema document declaration The sequence of URIs (if any) listed as location hints. In most cases there will only be one; but the import schema declaration in XQuery permits several. A set of absolute Uris identifying the query modules to be loaded. There is no requirement that these correspond one-to-one with the URIs defined in the locationHints. The returned URIs will be dereferenced by calling the GetEntity method. Dereference a URI returned by GetModules to retrieve a Stream containing the actual XML schema document. A URI returned by the GetSchemaDocuments method. Either a Stream or a String containing the query text. The supplied URI will be used as the base URI of the query module.