Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 2994

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="sourcedocs" page="builder-api" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Building a Source Document from an application</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Building a Source Document from an application"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Building a Source Document from an application</h1>
      <p>With the Java s9api interface, a source document can be built using the <a class="bodylink" href="../javadoc/net/sf/saxon/s9api/DocumentBuilder.html"><code>DocumentBuilder</code></a> class,
which is created using the factory method <code>newDocumentBuilder</code> on the <a class="bodylink" href="../javadoc/net/sf/saxon/s9api/Processor.html"><code>Processor</code></a> object. Various
 options for document building are available as methods on the <code>DocumentBuilder</code>, for example options
 to perform schema or DTD validation, to strip whitespace, to expand XInclude directives, and also to choose the
 tree implementation model to be used.</p>
      <p>Similarly in the .NET API, there is a <code>DocumentBuilder</code> object that can be created from the processor. This allows options
to be set controlling the way documents are built, and provides an overloaded <code>Build</code> method allowing a tree to
be built from various kinds of source.</p>
      <p>It is also possible to build a Saxon tree in memory by using the <code>buildDocument</code> method
of the <a class="bodylink" href="../javadoc/net/sf/saxon/Configuration.html"><code>Configuration</code></a> object. (When using the JAXP Transformation API, the <code>Configuration</code>
can be obtained from the <code>TransformerFactory</code> as the value of the attribute named <a class="bodylink"
            href="../javadoc/net/sf/saxon/lib/FeatureKeys.html#CONFIGURATION"><code>FeatureKeys.CONFIGURATION</code></a>.)</p>
      <p>The <a class="bodylink"
            href="../javadoc/net/sf/saxon/Configuration.html#buildDocument"><code>buildDocument()</code></a> method takes a single argument, a JAXP <code>Source</code>. This can be any of the standard
kinds of JAXP <code>Source</code>. See <a class="bodylink" href="../sourcedocs/jaxpsources.xml">JAXP Sources</a> for more information.</p>
      <p>All the documents processed in a single transformation or query must be loaded using the same
 <a class="bodylink" href="../javadoc/net/sf/saxon/Configuration.html"><code>Configuration</code></a>. However, it is possible to copy a document from one <code>Configuration</code>
 into another by supplying the <a class="bodylink" href="../javadoc/net/sf/saxon/om/DocumentInfo.html"><code>DocumentInfo</code></a> at the root of the existing document
 as the <code>Source</code> supplied to the <code>buildDocument()</code> method of the new Configuration.
 </p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="preloading.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>