directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Allen <mrchrisal...@gmail.com>
Subject Re: [mina] sample with XML
Date Fri, 06 Jan 2006 16:07:31 GMT
Hi,

I ended up using Jdom for paring the XML in my proxy server for Jabber
using MINA.  It worked very well.  Basically you can create a
ProtocolCodecFactory that uses a custom ProtocolDecoder.  The decoder
will have to overwrite the decode() method where it will convert the
ByteBuffer that it receives into an org.jdom.Document instance.  You
can either do the parsing of the XML there or do it in your
IoHandlerAdapter's messageReceived() method.

There is a good example of using a ProtocolCodecFactory for converting
the messages to Strings on the MINA website; it's basically the same
thing, except you convert it into either a Jdom Document like I'm
doing or one of the others that Vinod suggested.  Take a look at the
package org.apache.mina.filter.codec.textline for an example:
http://directory.apache.org/subprojects/network/xref/org/apache/mina/filter/codec/textline/package-summary.html

I hope that helps.

-Chris

On 1/6/06, Vinod Panicker <vinod.p@gmail.com> wrote:
> On 1/6/06, sylvain.eche@bnpparibas.com <sylvain.eche@bnpparibas.com> wrote:
> > Hi all
> >
> > Is there any source code that implement XML parsing for Mina ?
> > my Aim is to implement an XML parsing (as a decoder) that transform XML in
> > object and send this objects to the handler.
> > Has anyone see some sample about that ?
>
> Might sound silly, but have you considered using SAX / DOM / XPath for
> your XML parsing?  That will give you ready made objects that you can
> pass to your handler.
>
> Regards,
> Vinod.
>

Mime
View raw message