## Package net.sf.saxon.pull

This package provides an experimental pull API for Saxon: that is, it allows an application to read serially through a document, reading "events" such as the start and end of elements, text nodes, comments, and processing instructions, in the order in which they appear.

See:
Description

Interface Summary
PullProvider: PullProvider is Saxon's pull-based interface for reading XML documents.

Class Summary
PullConsumer: A PullConsumer consumes all the events supplied by a PullProvider, doing nothing with them.
PullFilter: PullFilter is a pass-through filter class that links one PullProvider to another PullProvider in a pipeline.
PullFromIterator: This class delivers any XPath sequence through the pull interface.
PullPushCopier: This class copies a document by using the pull interface to read the first document, and the push interface to write the second.
PullPushTee: PullPushTee is a pass-through filter class that links one PullProvider to another PullProvider in a pipeline, copying all events that are read into a push pipeline, supplied in the form of a Receiver.
PullSource: A PullSource is a JAXP Source that encapsulates a PullProvider - that is, an object that supplies an XML document as a sequence of events that are read under the control of the recipient.
PullTracer: PullTracer is a PullFilter that can be inserted into a pull pipeline for diagnostic purposes.
TreeWalker: This implementation of the Saxon pull interface starts from any NodeInfo, and returns the events corresponding to that node and its descendants (including their attributes and namespaces).

## Package net.sf.saxon.pull Description

This package provides an experimental pull API for Saxon: that is, it allows an application to read serially through a document, reading "events" such as the start and end of elements, text nodes, comments, and processing instructions, in the order in which they appear. In fact, the API allows access not just to a single document, but to any sequence consisting of nodes and atomic values: when a node is encountered, the pull API does a traversal of the subtree rooted at that node, before moving on to the next item in the sequence.

The API, defined in class `PullProvider`, is loosely modelled on the StAX `XMLReader` API. It is not identical, because it is designed as an intimate and efficient interface that integrates with Saxon concepts such as the `SequenceIterator` and the `NamePool`. A class `StaxBridge` is available that provides the `PullProvider` interface on top of a StAX pull parser; however, because pull parsing is not yet a standard feature of the Java platform, and because at the time of writing the available StAX parsers appear to be buggy, `StaxBridge` is not included in the `saxon.jar` distribution, but is instead supplied as a sample application in the `samples` directory.

Some examples of application code using the pull interface with Saxon are provided in the `PullExamples.java` file in the samples directory.

Michael H. Kay
Saxonica Limited
9 February 2005