> am thinking that, this object is used whenever I transform the huge
> XMLs. Am I right on this??

Xalan's internal model API is DTM.

DOMSource is used to indicate that the DTM API should be wrapped around a
user-provided DOM.

SAXSource is used to indicate that a DTM should be built from a
user-provided stream of SAX events.

StreamSource is used to indicate that a parser should be instantiated to
parse the user-provided text stream into a DTM; this is generally done by
using the SAXSource path internally.


> But I do not
> understand why we need to maintain the objects in memory while
> transforming the XML. Is there any specific reason??

XSLT includes operations which can refer back to earlier parts of the
document. That requires random access to all the document's contents, which
is generally impelemnted by building an in-memory model -- in our case, a
DTM.

Theoretically it should be possible to pre-analyse the stylesheet to
recognize those stylesheets which can operate without a persistant model,
or to retain only those portions of the model which will actually be
re-examined. Please search the archives of this mailing list for the
keywords "streaming" and "pruning" to find past discussion of possible
approaches to achieving that optimization. It's a difficult problem, and
Xalan does not implement it at this time.


> Coming to StreamSource it is stream mechanism. And What I am thinking
> is it is faster than SAX.

As noted above, a text stream just gets parsed into a SAX stream and
treated the same thereafter.

Reply via email to