[jdom-interest] JDOM->Xalan question

Eric Rosenberg eric at computerwizards.com
Wed Feb 28 21:54:10 PST 2001


Hi,

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.

Thank You,
Eric Rosenberg




More information about the jdom-interest mailing list