ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "André Rodrigues Pena" <andre.u...@gmail.com>
Subject Re: Return as XML
Date Wed, 11 Apr 2007 12:16:22 GMT
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 <meindert@pastelebusiness.com> 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:andre.ufrj@gmail.com]
>  Sent: 10 April 2007 10:19 PM
>  To: user-java@ibatis.apache.org
>  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

Mime
View raw message