You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Mike Engelhart <me...@earthtrip.com> on 2000/01/25 20:31:05 UTC

XSP/To DOM or Not To DOM

With all the talk that has happened in the last 24 hours I just want to be
taken to a "happy place" :-)

But since I can't do that, I'm wondering about what direction my supporting
classes should go as far as developing web applications.  My old JSP
application that I'm porting to XSP uses lots of collection classes for
storing queries to databases and legacy data that isn't really in any
structure at all.   I was mucking around with rewriting my SQL classes to
return DOM Document's or DocumentFragment's and then returning these to
custom producers.  Now that XSP has arrived (but obviously is still in
flux), I'm wondering if I should keep my support classes using Collections
and walk through them in the XSP pages to generate the XML document or if I
should continue along the DOM conversion path.   My feeling being a novice
DOM API user, is that I hate it.  I certainly would rather avoid having to
rewrite an application to support some other tree API but I also am unsure
of the overhead of constantly converting dynamic data between collections
and DOM.  

any thoughts would be appreciated.



Re: XSP/To DOM or Not To DOM

Posted by Mike Williams <mi...@o3.co.uk>.
  >>> On Tue, 25 Jan 2000 13:31:05 -0600,
  >>> "MikeE" == Mike Engelhart <me...@earthtrip.com> wrote:

  MikeW> Now that XSP has arrived (but obviously is still in flux), I'm
  MikeW> wondering if I should keep my support classes using Collections
  MikeE> and walk through them in the XSP pages to generate the XML
  MikeE> document or if I should continue along the DOM conversion path.

On one hand, it makes sense to leave your data in Java data-structures, and
just access them from XSP.  This is what I'm doing at the moment (see my
"XSP success story" post yesterday), and the performance is really rather
good.

But, what you lose is the ability to pull data out of arbitrary XML
data-structures.  This is not a big problem when data is dynamically
generated using Java, but it nice to be able to assemble static test-data
using XML.

An adaptor layer, so that an XSP page has a standard interface for
accessing data.  Two ways of doing this:

  (1) Have a wrapper for arbitrary JavaBeans, to provide a DOM-like
      API for accessing the data.

  (2) Have a generic way of extracting data from XML documents (DOMs), and
      creating corresponding JavaBean objects.

I tend to think (2) would provide better performance, as you would have no
overhead in the cases where you already have Java-native data.

-- 
Mike Williams