SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Notices
Using XSLT 2.0
Using XQuery
Handling Source Documents
| Handling Source Documents
| Source Documents on the Command Line
| Collections
| Building a Source Document from an application
| Preloading shared reference documents
| Writing input filters
| XInclude processing
| Saxon and XML 1.1
| JAXP Source Types
| Third-party Object Models: DOM, JDOM, XOM, and DOM4J
| Choosing a Tree Model
| The PTree File Format
| Validation of Source Documents
| Whitespace Stripping in Source Documents
» | Streaming of Large Documents
| Document Projection
XML Schema Processing
XPath API for Java
Saxon on .NET
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
Standards Conformance

# Reading source documents partially

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:

    some $t in saxon:stream(doc('big-transaction-file.xml')//transaction)
    satisfies number($t/@value) lt 0

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.

Next