SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
| Source Documents on the Command Line
| Saxon and XML 1.1
» | JAXP Source Types
| Third-party Object Models: DOM, JDOM, and XOM
| Choosing a Tree Model
| The PTree File Format
| Validation of Source Documents
| Whitespace Stripping in Source Documents
| Serial Processing of Large Documents
XML Schema Processing
The XPath API
Standards Conformance
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
XSLT Patterns

# JAXP Source Types

When a user application invokes Saxon via the Java API, then a source document is supplied as an instance of the JAXP `Source` class. This is true whether invoking an XSLT transformation, an XQuery query, or a free-standing XPath expression. The `Source` class is essentially a marker interface. The `Source` that is supplied must be a kind of `Source` that Saxon recognizes.

Saxon recognizes the three kinds of `Source` defined in JAXP: a `StreamSource`, a `SAXSource`, and a `DOMSource`. If a `DOMSource` is to be used, then the Saxon DOM support classes in `saxon8-dom.jar` must be on the class path.

Nodes in Saxon's implementation of the XPath data model are represented by the interface `net.sf.saxon.NodeInfo`. A `NodeInfo` is itself a `Source`, which means that any method in the API that requires a source object will accept any implementation of `net.sf.saxon.NodeInfo`.

Saxon allows additional `Source` types to be supported by registering a `SourceResolver` with the `Configuration` object. The task of a `SourceResolver` is to convert a `Source` that Saxon does not recognize into a `Source` that it does recognize. For example, this may be done by building the document tree in memory and returning the `NodeInfo` object representing the root of the tree.

Next