If you set up the API for SAX a DOM tree is NOT built. The Query result is cached as a string buffer and on request SAX events are generated from it.(as I understand it).
You can subsequently change your mind and ask for a DOM representation but the API makes a new DOM instance specially for you each time you do this.
This may seem a bit heavy rather than generating SAX events on the fly but in performance checks the overhead appeared to be minimal.
Here is an extract form the documentation
public class TaminoResult
implements TaminoResultInfo, java.util.Enumeration, java.io.Serializable
This delivers the complete Tamino response.
With the default construction of this result object by the TaminoClient using the DOM API, the result is represented as a DOM object (provided it can successfully be parsed). This has two uses: (a) To provide a DOM object to faciliate method calls like createElement, which are only implemented by the DOM Object. (b) For diagnostic purposes.
If the construction of this result object is by the TaminoClient using the SAX API, the result is represented by a StringBuffer object produced through a SAX parser. The user can then access the result, at either the complete result or individual document level, as a DOM object or a StringBuffer object or receive the corresponding SAX events.
The construction of the result object can be readily checked with the isDomApiGenerated() method call.
NOTE A DOM object is available however this result object is constructed. However, the DOM object returned from the SAX API construction is a new DOM object, parsed from the original result StringBuffer, every time it is requested by a getResultAsDOM() or getDocumentAsDOM(n) method call and the user must keep a pointer to a DOM object that is modified. A DOM API constructed result object contains a DOM, and a pointer to that DOM object is passed back whenever the getDocument() method is called. To emphasize this difference the getDocument() method is only available in DOM API generated result objects, otherwise it returns a null. The different methods available to each of the types of result are highlighted in the method summary.
This class represents the result of a Tamino operation