SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
| Version 8.9 (2007-02-12)
| Version 8.8 (2006-09-05)
| Version 8.7.3 (2006-06-13)
| Version 8.7.2 (2006-04-19)
| Version 8.7.1 (2006-04-13)
» | Version 8.7 (2006-02-24)
| Version 8.6.1 (24 November 2005)
| Version 8.6 (3 November 2005)
| Version 8.5.1 (26 August 2005)
| Version 8.5 (2 August 2005)
| Version 8.4 (4 April 2005)
| Version 8.3 (11 February 2005)
| Version 8.2 (21 December 2004)
| Version 8.1.1 (8 October 2004)
| Version 8.1 (24 September 2004)
| Version 8.0 (1 June 2004)
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
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

# Pull parser support

StAX parser support (Java)

Saxon has for a number of releases included a sample module `StaxBridge` that allows Saxon to take input from a StAX parser (JSR 173) (specifically from an `XMLStreamReader`). This component is now included in the product, as class `net.sf.saxon.pull.StaxBridge`.

To see how to use Saxon with the StAX parser, see the examples in `PullExamples.java` in the `samples/java` directory. A `StaxBridge` object is like a `SAXSource` object in that it encapsulates a reference to the parser and a reference to the file being parsed; it implements the JAXP `Source` interface so it can be used directly as an argument to methods like `Transformer.transform()`.

This code has been tested with the Sun implementation, SJSXP, and with the Woodstox parser. In both cases the parser must be separately installed. Note that if you want to recompile the Saxon source code and you do not have SJSXP installed, you can simply remove the StaxBridge module from the compilation.

Normally the `StaxBridge` class will pick up whichever StAX parser is present on the Java classpath. To choose a specific parser, set the system property `javax.xml.stream.XMLInputFactory` to the relevant implementation class. For SJSXP this is `com.sun.xml.stream.ZephyrParserFactory`. For Woodstox it is `com.ctc.wstx.stax.WstxInputFactory`.

XmlParser support (.NET)

On the .NET platform, Saxon allows input to be obtained from the `XmlReader` class defined in the `System.Xml` namespace. This offers a pull parser interface very similar to the `XMLStreamReader` of StAX.

To use this parser from the `Saxon.Api` interface, create a `Processor` and an `XmlReader`, then call `processor.NewDocumentBuilder().Build(reader)`.

Next