Ashish wrote:
Thanks Emmanuel!

The pointer was helpful. Though I though about implementing somewhat
in a different way.
Np. Hopefully, there are many possible ways :)
The decoder was implemented just to see the xml is complete and then
pass-on the buffer to an abstract function, to be
implemented by the user, picking an XML parser or Data binding
Framework of his choice, convert it to the Object as expected by their
Handler.
Sounds like a pragmatic approach. If you _know_ that your XML messages will be simple, and that you can detext the closing tag whatever data and comments you will have into your XML, and that you can afford some bad input, that's just a fine approach.

<snip/>
3. My limited knowledge of IoBuffer class has made code more cryptic
than it should have been :-)
The IoBuffer class is just a wrapper (a proxy) on top of ByteBuffer. Every BytBuffer method is available in IoBuffer, but you have a few more functionalities, one of them is that the IoBuffer is extensible (for the record, it would have been much easier to extend the ByteBuffer class to offer this functionality, but, sadly, this class can't be extended, as the constructor is not public ...). So if you know how to deal with ByteBuffer, you should be confortable with IoBuffer.
I am inclined towards using regular expression for parsing and will
post the code if I am able to do that.
You can also use JAXB with a byte stream unmarshaller (but a one which will be statefull). You may have to write your own unmarshaller, i'm afraid (but i'm not a specialist, so anyone with better knoweldge, please catch the ball ;)

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to