# 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