cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brendan Corcoran" <>
Subject Re: esql including java.sql.ResultSet
Date Thu, 01 Feb 2001 07:47:03 GMT
What I've got is an implementation of XMLFragment that goes through the
ResultSet from the JavaBean, and in to toSAX() method generates SAX events
based on the rows and columns of the ResultSet.

I have defined a class called XMLResultOutHelper() that implements
XMLFragment and extends a few JavaBeans.

Before I include the toSAX() method in my xsp, I set the xml_root field of
XMLResultOutHelper() - this is the tag that is going to encapsulate the
whole of the included ResultSet.  I also set the xml_row field of
XMLResultOutHelper() - this is the tag that will encapsulate each row of the

So when I include the toSAX() method in my xsp, the resulting xml is
something like:

<db_members_query> - xml_root field
    <member> - xml_row field
        <elem name="member_id">1</elem>
        <elem name="member_surname">Bloggs</elem>
        <elem name="member_id">2</elem>
        <elem name="member_surname">Braggs</elem>

I was wondering if this was the cleanest, most efficient way to include
information from a JavaBean that returns a ResultSet from a database....

Or should I be looking at packaging the ResultSet into an xml String in the
JavaBean and including it from there?



----- Original Message -----
From: "Donald Ball" <>
To: <>
Sent: Thursday, February 01, 2001 2:46 PM
Subject: Re: esql including java.sql.ResultSet

> On Thu, 1 Feb 2001, Brendan Corcoran wrote:
> > I am trying to insert dynamic xml.  I have a JavaBean that returns a
> > java.sql.ResultSet to my xsp page, and I then pass this into the
> > interface that generates SAX events so that I can include the ResultSet
> > xml in my document.
> >
> > Is it possible to plug the ResultSet from the JavaBean into the esql
> > to include the ResultSet as xml in my document, and to do further
> > processing?  This is instead of going through the XMLFragment
> not really, no. the esql logicsheet's methods must operate in context to
> work. if you were to duplicate the support environment created by the esql
> logicsheet, you'd be able to use the access methods, but why bother? the
> access methods are just wrappers for methods on the JDBC ResultSet and
> ResultSetMetaData classes, there's little value-add there. the nice thing
> about esql, imho, is that it does all of the low-level stuff for you in a
> relatively sane way. overall. if you've got a bean of your own that does
> all of that low-level stuff for you, better just to use it, i'd think. if
> you want the get-xml code, look in the source and copy it, or see if you
> can use the methods in the util logicsheet to include your xml. or am i
> missing something? Are you having trouble using your resultset's data in
> calls to other logicsheets?
> - donald
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <>
> To unsubscribe, e-mail: <>
> For additional commands, e-mail: <>

View raw message