SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
| Handling Source Documents
| Source Documents on the Command Line
| Collections
» | Building a Source Document from an application
| Writing input filters
| XInclude processing
| Saxon and XML 1.1
| JAXP Source Types
| Third-party Object Models: DOM, JDOM, XOM, and DOM4J
| Choosing a Tree Model
| The PTree File Format
| Validation of Source Documents
| Whitespace Stripping in Source Documents
| Streaming of Large 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

# Building a Source Document from an application

In Java, the recommended way to build a Saxon tree in memory is to use the `buildDocument` method of the `Configuration` object. (When using the JAXP Transformation API, the `Configuration` can be obtained from the `TransformerFactory` as the value of the attribute named `FeatureKeys.CONFIGURATION`.)

All the documents processed in a single transformation or query must be loaded using the same `Configuration`.

The `buildDocument()` method takes a single argument, a JAXP `Source`. This can be any of the standard kinds of JAXP `Source`. See JAXP Sources for more information.

In the .NET API, there is a `DocumentBuilder` object that can be created from the processor. This allows options to be set controlling the way documents are built, and provides an overloaded `Build` method allowing a tree to be built from various kinds of source.

Next