Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 3010

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="streaming" subpage="partialreading"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Reading source documents partially</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Reading source documents partially"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Reading source documents partially</h1>
      <p>As well as allowing a source document to be processed in a single sequential pass, the streaming
facility in many cases allows the source document to be read only partially. For example, the following query
will return true as soon as it finds a transaction with a negative value, and will then immediately stop processing
the input file:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>
some $t in saxon:stream(doc('big-transaction-file.xml')//transaction)
satisfies number($t/@value) lt 0
</code>
         </pre>
      </div>
      <p>This facility is particularly useful for extracting data that appears near the start of a large file. It does mean,
however, that well-formedness or validity errors appearing later in the file will not necessarily be detected.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="streamable-xpath.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>