[jdom-interest] DOMOutputter

Mike Engelhart mengelhart at earthtrip.com
Tue Aug 22 14:21:09 PDT 2000


I'm using JDOM with servlets that are eventually being processed using XSP and Apache Cocoon.   I have a class SQLSelect for example that returns a org.jdom.Element which contains the result set.   To get this to work with XSP/Cocoon which is currently DOM based, I have to create a JDOM Document, then create a DOMOutputter, then call output(), then take the org.w3c.dom.Document and remove the Node/Element that I need and pass it to the XSP which is doing the output processing.   This seems a bit heavy handed to me.   I've only been using JDOM for about a week now (and love it!) but I'm wondering if it wouldn't be good to add more overridden output() methods to DOMOutputter to handle situations like this.  What I'm thinking about is something like this:

org.w3c.dom.Element output(org.jdom.Element e) 


org.w3c.dom.Node output(org.jdom.Element e) 

Is there any speed/memory increase in avoiding filling a DOM Document and then scraping out what is needed by implementing the above method calls or something like them that deals with fragments rather than whole documents?  I guess you're always going to have to create a Document object so you can get at it's factory methods huh?  (whose idea was that anyway :-) )



More information about the jdom-interest mailing list