[jdom-interest] Re: DOMBuilder vs PipedStreams
Lennon Day-Reynolds
lennon at allpredict.com
Mon Jan 15 15:55:35 PST 2001
The org.jdom.adapters package contains adapter classes that can be used with
XMLOutputter and most of the major parsers to produce a compatible DOM
model, so you're not really locked in to any one platform. Using the
PipedInput/OutputStream classes would work more universally, but you incur
the overhead of parsing the same document twice -- once to build the JDOM
tree, and once when the receiving end builds its DOM tree from the text form
of the JDOM document. Plus, you have to pump the entire JDOM tree through
the XMLOutputter, are limited to byte-oriented insead of character-based I/O
through the piped streams...all in all, a lot of overhead.
If your classes/threads are running in the same VM, you will almost
undoubtedly get better performance, document integrity, and reliability by
simply building the DOM tree, and passing it to the receiving side. The only
case in which I could really see it making sense going through the full
JDOM -> XML -> DOM parsing cycle would be if your data needed to be sent
over a network connection.
-----------------------------------
Lennon Day-Reynolds
Java Engineer
AllPredict, Inc.
lennon at allpredict.com
415-876-7500 ofc
240-250-5593 fax
http://www.allpredict.com/
AllPredict BuddyName: lennon
-----------------------------------
More information about the jdom-interest
mailing list