<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>SchemaValidator</title> <meta name="keywords" content="Saxon.Api.SchemaValidator class"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> </head> <body> <div style="width:20%; float:left; background-color:#c1cede; overflow:auto; height:100%"> <h2>Saxon.Api</h2> <div style="position:relative; height:4pt"> <p>Class <a href="DocumentBuilder.html">DocumentBuilder</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DomDestination.html">DomDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DynamicContext.html">DynamicContext</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="DynamicError.html">DynamicError</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="EmptyEnumerator.html">EmptyEnumerator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="ExtensionFunctionCall.html">ExtensionFunctionCall</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="ExtensionFunctionDefinition.html">ExtensionFunctionDefinition</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="NullDestination.html">NullDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="Processor.html">Processor</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="QName.html">QName</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="SchemaManager.html">SchemaManager</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="SchemaValidator.html">SchemaValidator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="Serializer.html">Serializer</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="StaticContext.html">StaticContext</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="StaticError.html">StaticError</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="TextWriterDestination.html">TextWriterDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathCompiler.html">XPathCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathExecutable.html">XPathExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XPathSelector.html">XPathSelector</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryCompiler.html">XQueryCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryEvaluator.html">XQueryEvaluator</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XQueryExecutable.html">XQueryExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyFunctionType.html">XdmAnyFunctionType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyItemType.html">XdmAnyItemType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAnyNodeType.html">XdmAnyNodeType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAtomicType.html">XdmAtomicType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmAtomicValue.html">XdmAtomicValue</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmDestination.html">XdmDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmEmptySequence.html">XdmEmptySequence</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmFunctionItem.html">XdmFunctionItem</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmItem.html">XdmItem</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmItemType.html">XdmItemType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmNode.html">XdmNode</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmNodeKind.html">XdmNodeKind</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmSequenceType.html">XdmSequenceType</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XdmValue.html">XdmValue</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XmlDestination.html">XmlDestination</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltCompiler.html">XsltCompiler</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltExecutable.html">XsltExecutable</a></p> </div> <div style="position:relative; height:4pt"> <p>Class <a href="XsltTransformer.html">XsltTransformer</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="RecoveryPolicy.html">RecoveryPolicy</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="SchemaValidationMode.html">SchemaValidationMode</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="TreeModel.html">TreeModel</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="WhitespacePolicy.html">WhitespacePolicy</a></p> </div> <div style="position:relative; height:4pt"> <p>Enum <a href="XdmAxis.html">XdmAxis</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IMessageListener.html">IMessageListener</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IQueryResolver.html">IQueryResolver</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IResultDocumentHandler.html">IResultDocumentHandler</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IXdmEnumerator.html">IXdmEnumerator</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="IXmlLocation.html">IXmlLocation</a></p> </div> <div style="position:relative; height:4pt"> <p>Interface <a href="SchemaResolver.html">SchemaResolver</a></p> </div> </div> <div style="width:5%; float:left; background-color:#e4eef0; overflow:auto; height:100%"> </div> <div style="float:left; width:75%; overflow:auto; height:100%;"> <h2><font size="-1">Saxon.Api</font><br>Class SchemaValidator </h2> <hr> <dl> <dt><pre>public class SchemaValidator</pre></dt> <dt> implements <a href="http://msdn.microsoft.com/en-us/library/system.object(VS.80).aspx">object</a></dt> </dl> <dl> <dd> <p> A <code>SchemaValidator</code> 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 <code>SchemaManager</code>, together with any additional schema components located during the course of validation by means of an <code>xsl:schemaLocation</code> or <code>xsi:noNamespaceSchemaLocation</code> attribute within the instance document. </p> <p> 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. </p> </dd> </dl> <hr><a name="property_summary"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Property Summary</b></font></th> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="http://msdn.microsoft.com/en-us/library/system.boolean(VS.80).aspx">bool</a></code></td> <td><code><b><a href="#IsLax">IsLax</a></b></code><p> 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. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> Boolean</code></td> <td><code><b><a href="#UseXsiSchemaLocation">UseXsiSchemaLocation</a></b></code><p> This property defines whether the schema processor will recognize, and attempt to dereference, any <code>xsi:schemaLocation</code> and <code>xsi:noNamespaceSchemaLocation</code> attributes encountered in the instance document. The default value is true. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> <a href="http://msdn.microsoft.com/en-us/library/system.collections.ilist(VS.80).aspx">IList</a></code></td> <td><code><b><a href="#ErrorList">ErrorList</a></b></code><p> 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. </p> </td> </tr> </table> <a name="method_summary"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Method Summary</b></font></th> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#SetSource(System.IO.Stream,System.Uri)">SetSource</a></b>(<a href="http://msdn.microsoft.com/en-us/library/system.io.stream(VS.80).aspx">System.IO.Stream</a> source, System.Uri baseUri)</code><p> Supply the instance document to be validated in the form of a Stream </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#SetSource(System.Uri)">SetSource</a></b>(System.Uri uri)</code><p> Supply the instance document to be validated in the form of a Uri reference </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#SetSource(System.Xml.XmlReader)">SetSource</a></b>(<a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader(VS.80).aspx">System.Xml.XmlReader</a> reader)</code><p> Supply the instance document to be validated, in the form of an XmlReader. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#SetSource(Saxon.Api.XdmNode)">SetSource</a></b>(<a href="XdmNode.html">XdmNode</a> source)</code><p> Supply the instance document to be validated in the form of an XdmNode </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#SetDestination(Saxon.Api.XmlDestination)">SetDestination</a></b>(<a href="XmlDestination.html">XmlDestination</a> destination)</code><p> Supply the destination to hold the validated document. If no destination is supplied, the validated document is discarded. </p> </td> </tr> <tr bgcolor="white" class="TableRowColor"> <td align="right" valign="top" width="1%"><code> void</code></td> <td><code><b><a href="#Run()">Run</a></b>()</code><p> Run the validation of the supplied source document, optionally writing the validated document to the supplied destination. </p> </td> </tr> </table> <a name="property_detail"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Property Detail</b></font></th> </tr> </table><a name="IsLax"></a><h3>IsLax</h3><pre>public <a href="http://msdn.microsoft.com/en-us/library/system.boolean(VS.80).aspx">bool</a> <b>IsLax</b> {get; set; }</pre><dl> <dd> <p> 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. </p> </dd> </dl> <hr><a name="UseXsiSchemaLocation"></a><h3>UseXsiSchemaLocation</h3><pre>public Boolean <b>UseXsiSchemaLocation</b> {get; set; }</pre><dl> <dd> <p> This property defines whether the schema processor will recognize, and attempt to dereference, any <code>xsi:schemaLocation</code> and <code>xsi:noNamespaceSchemaLocation</code> attributes encountered in the instance document. The default value is true. </p> </dd> </dl> <hr><a name="ErrorList"></a><h3>ErrorList</h3><pre>public <a href="http://msdn.microsoft.com/en-us/library/system.collections.ilist(VS.80).aspx">IList</a> <b>ErrorList</b> {get; set; }</pre><dl> <dd> <p> 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. </p> <p>By supplying a custom List with a user-written add() method, it is possible to intercept error conditions as they occur. </p> <p>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. </p> </dd> </dl> <hr><a name="method_detail"></a><table border="1" width="100%" cellpadding="3" cellspacing="0" summary=""> <tr border="#ccccff" class="TableHeadingColor"> <th align="left" colspan="2"><font size="+2"><b>Method Detail</b></font></th> </tr> </table><a name="SetSource(System.IO.Stream,System.Uri)"></a><h3>SetSource</h3><pre>public void <b>SetSource</b>(<a href="http://msdn.microsoft.com/en-us/library/system.io.stream(VS.80).aspx">System.IO.Stream</a> source, System.Uri baseUri)</pre><dl> <dd> <p> Supply the instance document to be validated in the form of a Stream </p><b>Parameters:</b><dl> <dt><code>source</code> - </dt> <dd>A stream containing the XML document to be parsed and validated. This stream will be consumed by the validation process, but it will not be closed after use: that is the responsibility of the caller. </dd> </dl> <dl> <dt><code>baseUri</code> - </dt> <dd>The base URI to be used for resolving any relative references, for example a reference to an <code>xsi:schemaLocation</code> </dd> </dl> </dd> </dl> <hr><a name="SetSource(System.Uri)"></a><h3>SetSource</h3><pre>public void <b>SetSource</b>(System.Uri uri)</pre><dl> <dd> <p> Supply the instance document to be validated in the form of a Uri reference </p><b>Parameters:</b><dl> <dt><code>uri</code> - </dt> <dd>URI of the document to be validated</dd> </dl> </dd> </dl> <hr><a name="SetSource(System.Xml.XmlReader)"></a><h3>SetSource</h3><pre>public void <b>SetSource</b>(<a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader(VS.80).aspx">System.Xml.XmlReader</a> reader)</pre><dl> <dd> <p> Supply the instance document to be validated, in the form of an XmlReader. </p> <p> The XmlReader is responsible for parsing the document; this method validates it. </p><b>Parameters:</b><dl> <dt><code>reader</code> - </dt> <dd>The <code>XmlReader</code> used to read and parse the instance document being validated. This is used as supplied. For conformance, use of a plain <code>XmlTextReader</code> is discouraged, because it does not expand entity references. This may cause validation failures. </dd> </dl> </dd> </dl> <hr><a name="SetSource(Saxon.Api.XdmNode)"></a><h3>SetSource</h3><pre>public void <b>SetSource</b>(<a href="XdmNode.html">XdmNode</a> source)</pre><dl> <dd> <p> Supply the instance document to be validated in the form of an XdmNode </p> <p>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. </p> <b>Parameters:</b><dl> <dt><code>source</code> - </dt> <dd>The document or element node at the root of the tree to be validated </dd> </dl> </dd> </dl> <hr><a name="SetDestination(Saxon.Api.XmlDestination)"></a><h3>SetDestination</h3><pre>public void <b>SetDestination</b>(<a href="XmlDestination.html">XmlDestination</a> destination)</pre><dl> <dd> <p> Supply the destination to hold the validated document. If no destination is supplied, the validated document is discarded. </p> <p> 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. </p><b>Parameters:</b><dl> <dt><code>destination</code> - </dt> <dd> The destination to hold the validated document. </dd> </dl> </dd> </dl> <hr><a name="Run()"></a><h3>Run</h3><pre>public void <b>Run</b>()</pre><dl> <dd> <p> Run the validation of the supplied source document, optionally writing the validated document to the supplied destination. </p> </dd> </dl> <hr> </div> </body> </html>