<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="changes" page="intro92" subpage="s9api92"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: S9API interface</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: S9API interface"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>S9API interface</h1>
      <p>Separate compilation of XQuery modules is available (under Saxon-EE only). An overloaded method <code>compileLibrary()</code> is available
in the <code>XQueryCompiler</code> class to compile a library module; any subsequent compilation using the same <code>XQueryCompiler</code> may
import this module (using <code>import module</code> specifying only a module URI - any location hint will be ignored), and the global functions
and variables declared in the library module will be imported without incurring the cost of recompiling them.</p>
      <p>The <code>XPathCompiler</code> has a new option to permit undeclared variables in XPath expressions. This allows an expression to be
compiled without pre-declaring the variables that it references. It is possible to discover what variables are used in the expression (so that
they can be initialized) by means of new methods provided on the <code>XPathExecutable</code> object.</p>
      <p>The class <code>XdmValue</code> has a new method <code>append()</code> allowing a new <code>XdmValue</code>
to be constructed by concatenating two existing instances of <code>XdmValue</code>.</p>
      <p>The classes <code>DocumentBuilder</code> and <code>XdmDestination</code> have a new method <code>setTreeModel()</code>
(and a corresponding accessor <code>getTreeModel()</code>) to indicate that what tree model should be used for 
the constructed tree. This allows selection of a linked tree in the case where XQuery Update access is required,
or of the new condensed tiny tree. These methods are defined in terms of a new <code>TreeModel</code> class which in principle
defines an extensibility point where new user-defined tree models can be supported.</p>
      <p>The class <code>XdmNode</code> has a new method <code>getColumnNumber()</code> allowing the column number in the original
lexical XML to be obtained, in cases where line numbers have been preserved.</p>
      <p>The <code>Processor</code> object is now accessible to the code of extension functions by calling
<code>context.getConfiguration().getProcessor()</code>, assuming that the method in question has a first argument of type
<code>net.sf.saxon.expr.XPathContext</code>. This is useful when the extension function wants to create new
nodes or invoke Saxon operations such as XSLT or XQuery processing.</p>
      <p>A new mechanism is provided in the s9api <code>Processor</code>
for declaring so-called <i>integrated</i> extension functions. Unlike traditional extension functions invoked
as Java methods through reflexion, an integrated extension function is implemented as a pair of classes: a class that extends the
abstract class <code>net.sf.saxon.functions.ExtensionFunctionDefinition</code>, which defines static properties of the extension function,
 and a second class which extends <code>net.sf.saxon.functions.ExtensionFunctionCall</code>, and represents a specific call on the extension
 function, and provides a <code>call()</code> method to evaluate its result.</p>
      <p>Many Saxon extension functions have been re-implemented using this mechanism; examples are
<code>saxon:parse()</code> and <code>saxon:serialize()</code>.</p>
      <p>The <code>XsltTransformer</code> class now has methods to get and set an <code>ErrorListener</code> for dynamic errors.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="dotnet92.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>