mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <ayyagariki...@gmail.com>
Subject Re: MINA - design guidelines
Date Thu, 23 Oct 2008 15:17:30 GMT
How about using a xml pull parser http://www.xmlpull.org/. ( I have used 
it for reading the xmpp stanzas from a socket in a toy xmpp server impl )

Kiran Ayyagari

Ashish wrote:
>> 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
>> ;)
>>     
>
> Well the problem of getting multiple xml mesages back to back, was
> what I was trying to resolve.
> But couldn't, coz, again didn't knew how to remove the read part from
> IoBuffer, once the trailing message was detected
> and if it continued for a while my System would be out of memory, I guess.
>
> BTW, when does the IoBuffer gets free up?
>
> Using an XML parser would be like too much, coz it would parse and
> throw parse exception each time the xml was incomplete
> and if the IoBuffer had trailing xml message, it won't parse crying
> about invalid message :-(
>
> Again performance becomes critical. If anybody intent to use a similar
> implementation, VTD-XML parser (http://vtd-xml.sourceforge.net/) will
> be worth evaluating.
>
> I need to do some homework on IoBuffer/ByteBuffer, like how to copy
> chunk from middle (something like substring)
> and how to remove the mark once it's set. :-)
> Long way to go
>
>
>  

Mime
View raw message