Project

Profile

Help

How to connect?
Download (2.34 KB) Statistics
| Branch: | Tag: | Revision:

he / latest9.0 / bj / net / sf / saxon / pull / package.html @ c25835af

1
<html>
2

    
3
<head>
4
<title>Package overview for net.sf.saxon.pull</title>
5
</head>
6

    
7
<body>
8

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

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

    
25
<p>The three main kinds of <code>PullProvider</code> are:</p>
26

    
27
<ul>
28
<li><p>StaxBridge, which is an interface to a pull-mode XML parser</p></li>
29

    
30
<li><p>TreeWalker, which delivers events based on an in-memory tree. There is one
31
general-purpose TreeWalker that can handle any Saxon tree (any tree that implements the NodeInfo interface)
32
and aother that is optimized to the TinyTree implementation.</p></li>
33

    
34
<li><p>VirtualTreeWalker, which delivers events representing the nodes constructed by a
35
stylesheet or query, without actually constructing the nodes in memory.
36
(Note that this doesn't currently work if the constructed nodes need to be schema-validated).</p></li>
37
</ul>
38

    
39
<p>Some examples of application code using the pull interface with Saxon are provided in the
40
<code>PullExamples.java</code> file in the samples directory.</p>
41

    
42

    
43
<p align="center"><i>Michael H. Kay<br/>
44
Saxonica Limited<br/>
45
30 March 2005</i></p>
46
</body>
47
</html>
(21-21/21)