<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="sourcedocs" page="choosingmodel" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Choosing a Tree Model</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Choosing a Tree Model"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Choosing a Tree Model</h1>
      <p>Saxon provides several implementations of the internal tree data structure (or tree model).
The tree model can be chosen by an option on the command line (-tree:tiny for the tiny tree, -tree:linked
for the linked tree [previously known as the "standard tree"]). There is also a variant of the tiny tree
called a "condensed tiny tree" which saves space (at the expense of build time) by recognizing text nodes and
attribute nodes whose values appear more than once in the input document. 
The tree model can also be selected from the Java API. The default is to use the tiny tree model.
The choice should make no difference to the results of a transformation (except the order
of attributes and namespace declarations) but only affects performance.</p>
      <p><i>The "linked tree" is the only model to support updates, so if you are using XQuery Update
you must choose this model.</i></p>
      <p>Generally speaking, the tiny tree model is both faster to build and faster to navigate.
It also uses less space.</p>
      <p>The tiny tree model gives most benefit when you are processing a large document. It uses
a lot less memory, so it can prevent thrashing when the size of document
is such that the linked tree doesn't fit in real memory. Use the "condensed" variant if you need to save
memory, and if your source data contains many text or attribute nodes with repeated values.</p>
      <p>The linked tree is used internally to represent stylesheet and schema modules because
of the programming convenience it offers: it allows element nodes on the tree to be
represented by custom classes for each kind of element. The linked tree is also needed when
you want to use XQuery Update, because unlike the TinyTree, it is mutable.</p>
      <p><i>If in doubt, stick with the default.</i></p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="ptree.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>