Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 2990

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="schema-processing" page="validation-api" subpage="schema-s9api"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Schema Processing using s9api</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Schema Processing using s9api"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Schema Processing using s9api</h1>
      <p>The s9api interface allows schemas to be loaded into a <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/Processor.html"><code>Processor</code></a>, and then
to be used for validating instances, or for schema-aware XSLT and XQuery processing.</p>
      <p>The main steps are:</p>
      <ol>
         <li content="para">
            <p>Create a Processor (<a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/Processor.html"><code>net.sf.saxon.s9api.Processor</code></a>) and call its
<code>getSchemaManager()</code> method to get a <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/SchemaManager.html"><code>SchemaManager</code></a>.</p>
         </li>
         <li content="para">
            <p>If required, set options on the <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/SchemaManager.html"><code>SchemaManager</code></a> to control the way in which schema documents
will be loaded.</p>
         </li>
         <li content="para">
            <p>Load a schema document by calling the <code>load()</code> method, which takes a JAXP
Source object as its argument. The resulting schema document is available to all applications run within
the containing <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/Processor.html"><code>Processor</code></a>.</p>
         </li>
         <li content="para">
            <p>To validate an instance document, call the <code>newSchemaValidator</code> method on the
               <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/SchemaManager.html"><code>SchemaManager</code></a> object. </p>
         </li>
         <li content="para">
            <p>Set options on the <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/SchemaValidator.html"><code>SchemaValidator</code></a> to control the way in which a particular validation
episode is performed, and then invoke its <code>validate()</code> method to validate an instance document.</p>
         </li>
      </ol>
      <p>Note that additional schemas referenced from the <code>xsi:schemaLocation</code> attributes
within the source documents will be loaded as necessary. A target namespace is ignored if there is already
a loaded schema for that namespace; Saxon makes no attempt to load multiple schemas for the same
namespace and check them for consistency.</p>
      <p>Although the API is defined in such a way that a <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/SchemaValidator.html"><code>SchemaValidator</code></a>
            is created for a particular <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/SchemaManager.html"><code>SchemaManager</code></a>, in the Saxon implementation the schema components that
are available to the validator are not only the components within that schema, but all the components that form part
of any schema registered with the <code>Processor</code> (or indeed, with the underlying <code>Configuration</code>)</p>
      <p>The <code>SchemaValidator</code> implements the <a class="bodylink" href="../../javadoc/net/sf/saxon/s9api/Destination.html"><code>Destination</code></a> interface, which means it can be used to receive
input from any process that writes to a <code>Destination</code>, for example an XSLT transformation or an XQuery query.
The result of validation can also be sent to any <code>Destination</code>, for example an XSLT transformer.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="schema-jaxp.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>