[jdom-interest] JDOM->Xalan question
shauns at pixology.com
Thu Mar 1 03:41:53 PST 2001
I think that the most efficient way of talking to Xalan is to
send SAX events directly to its handler, using SAXOutputter. Thanks
to everyone who worked on that for JDOM-B6 by the way!
Doing it that way should cause the least performance penalty;
is definitely heavier (on memory at least) than JDOM->SAX->Transform.
Use it like this:
obtain TransformerHandler from Xalan
Create new SAXOutputter, pass the TransformerHandler in constructor
Set a destination for the result from TransformerHandler
Call the SAXOutputter.output( Document ) method
From: Eric Rosenberg [mailto:eric at computerwizards.com]
Sent: 01 March 2001 05:54
To: jdom-interest at jdom.org
Subject: [jdom-interest] JDOM->Xalan question
I'm implementing an application where I need to build a XML document in
memory, then apply an XSL transform to it and return the resulting
document. My current implementation builds the XML document as a big
String, this String is then passed to Xerces/Xalan for
parsing/transform, and the result is turned into a String and returned.
This has proven to be a less then ideal for several reasons. Instead of
a big String I would like to build the XML document directly in memory
and then apply the transform to it. My thought is that doing this would
potentially save me the step of parsing the string that I am
constructing, since the XML document would already be a DOM object.
I recently ran across JDOM while reading Java World and it occurred to
me that this may be a good fit for my problem. My idea was to build the
document in memory using JDOM and then feed it to Xalan to do the
transform. The API for building the document seems a lot simpler using
JDOM then trying to build it as a straight DOM object. However, I was
curious as to how much of a performance penalty, if any, I am going to
incur by building a JDOM Document in memory, and then transforming it
into a DOM object instead of just building the DOM object directly.
I am also curious as to what is the most efficient mechanism to
implement the processing chain of JDOM->Xalan. I noticed in the FAQ you
mentioned that you should just write out the JDOM object to a Stream and
feed that to XSLTInputSource, but is there a better way to do
this? Would it be faster to convert the JDOM object to a DOM object and
pass that to XSLTInputSource directly?
I'd appreciate any information that you could provide.
To control your jdom-interest membership:
More information about the jdom-interest