Saxonica.com

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.)

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.

All the documents processed in a single transformation or query must be loaded using the same Configuration. However, it is possible to copy a document from one Configuration into another by supplying the DocumentInfo at the root of the existing document as the Source supplied to the buildDocument() method of the new Configuration.

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