Another way to do this (that will be less code, but an added
dependency) is with a tool like xstream: http://xstream.codehaus.org/
If you search the archives, I know someone posted an example, and it
was pretty darn slick.
Larry
On 4/11/07, André Rodrigues Pena <[EMAIL PROTECTED]> wrote:
Meindert, thanks for your reply.
I'm gonna test your tips through the day, If I have questions I call you back.
Cheers
On 4/11/07, Meindert <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Yes;
>
> <select id="messageQueue" parameterClass="map" resultClass="xml"
> xmlResultName="Message">
>
>
>
> And you probably want to have control on the rows returned so you might need
> to add a rowhandler
>
>
>
> Call to query
>
> RowHandler rowHandler=new xmlRowHandler("mailQueue");
>
> queryWithRowHandler("messageQueue", myParam, rowHandler);
> // go through the list
>
> Document doc = ((xmlRowHandler) rowHandler).getDomDocument();
>
> return doc.getRootElement();
>
>
>
> row handler
>
> /* Inner Classes */
>
> public static class xmlRowHandler implements RowHandler{
>
>
>
> private Document domDocument;
>
>
>
> public xmlRowHandler(String xmlResultName){
>
> domDocument = DocumentHelper.createDocument();
>
> Element root = getDomDocument().addElement( xmlResultName );
>
> }
>
>
>
> public void handleRow(Object object){
>
> try{
>
> Document xmlFragment = DocumentHelper.parseText((String)
> object);
>
> Element xmlElement= xmlFragment.getRootElement();
>
> Element root =
> getDomDocument().getRootElement();
>
> root.add(xmlElement);
>
> }catch(DocumentException e){
>
> logger.error("Parsing failed;" + e.getMessage());
>
> }
>
>
>
> }
>
>
>
> public Document getDomDocument() {
>
> return domDocument;
>
>
> }
>
> }
>
>
>
>
>
> -----Original Message-----
> From: André Rodrigues Pena [mailto:[EMAIL PROTECTED]
> Sent: 10 April 2007 10:19 PM
> To: [email protected]
> Subject: Return as XML
>
>
>
> Hi all,
>
> I'm new on iBatis. Can I have the results from SELECT and STORED
>
> PROCEDURE to be in XML format?
>
>
>
> How do I do that? Thanks!
>
>
>
> --
>
> André Rodrigues Pena
>
>
>
> LOCUS
>
> www.locus.com.br
>
>
>
> Blog
>
> www.techbreak.org
--
André Rodrigues Pena
LOCUS
www.locus.com.br
Blog
www.techbreak.org