On Mar 16, 2007, at 1:54 PM, Eric J. Schwarzenbach wrote:
Santiago Pericas-Geertsen wrote:
JAXP 1.4/JDK 6.0 has a new package called javax.xml.transform.stax,
in which you'll find a StAXSource class [1]. Note that internally
Xalan/XSLTC build a document model (DTM) from SAX events, so
there's a
StAX -> SAX conversion when starting from a StAXSource. Thus,
depending on the parsers in question, there may be no performance
advantage in using a StAXSource.
FWIW, last time I tried (maybe six months ago, maybe 1 or 2
versions of
Xerces ago), I found absolutely no performance advantage to
performing a
transform from a SAX source over doing so from a stream source.
I wouldn't expect a different in that case, unless the SAXSource is
constructed from an XMLReader that has some performance advantage
over the one used by Xalan. When you pass a StreamSource, the XSLT
engine creates an XMLReader for it, so in essence this is similar to
a SAXSource.
When passing a SAXSource, however, you may have control over which
XMLReader to use. So, as I said above, you could pass an instance of
an XMLReader that is faster than the one used internally by Xalan
(i.e., typically Xerces).
-- Santiago