# 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