[XSL-LIST Mailing List Archive Home]
Re: [xsl] StreamSource vs SAXSource
Subject: Re: [xsl] StreamSource vs SAXSource|
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Sun, 02 Nov 2003 12:52:42 +0100
Pramodh Peddi wrote:
I understand the differences between DOMSource and SAXSource. But, I din't
quite understand the differences (in terms of memory and time consumption)
between SAXSource and StreamSource.
When I have XML String to be transformed against a xsl. Which Source is the
best in terms of memory and time? SAXSource? StreamSource? I guess When we
have an XML Stream, StreamSource is better.
This borders on being off-topic for this list but anyway.
There is not much difference in terms of memory an processing
time for SAXSource vs. StreamSource itself. The kind of source
you have to use is determined by the form you get the XML.
If you read the XML from a file or an URL connection, or if
you somehow get a string, then you have to use a StreamSource.
There are basically two reasons to prefer a SAXSource instead of a
If you get, for example, the data already in a prestructured
form, like an SAX event stream or as the result set of a database,
then it might be more useful to use a SAX source instead of going
through the trouble of building a serialized XML stream to feed
into a StreamSource. This means of course providing a custom
XMLReader to the SAXSource.
The other reason to use a SAXSource if you have to take some
control over the parser or its configuration, for example for
providing a custom entity resolver or forcing schema validation.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list