In an application server, I have a connection with an XML database. I am able to retrieve results in either SAX or DOM format.

The result should be passed from the application server to the webserver. Should I:

- store all sax elements in some kind of object (what object?) and pass the object over the network as a result of a session bean call? This should generate the least network traffic, but is there a standard object to accomplish this?
- create some kind of SAX stream between the application server and the webserver? Which technique to use to prevent overhead by network round trips?
- Return a dom object from the app server to the webserver. This is probably the same as option 1, but has too much overhead in creating the dom document and there's probably more network traffic with this solution.

Any ideas, code samples or guidelines?

Michael Homeijer