[jdev] parsing xml (xmpp) with ruby
Eric Will
rakaur at malkier.net
Mon Sep 29 10:44:52 CDT 2008
My main problem isn't the TLS (I'm the server, so I don't have to
worry about it since I send the initial binary), but how to figure out
when I've read()'d a complete stanza. In IRC I can read and read and
read until I get a "\n", but that's not the case in XMPP. There is no
simple way to reason out when a stanza has ended. The way everyone
seems to use is "use a SAX parser, then make a DOM out of that" which,
to me, sucks. Plus, I'm using Ruby, so if I'm using a C parser like
libxml to do the SAX, and then do all this mumbo jumbo in Ruby, it's
going to cost me in terms of performance pretty badly.
My question is this: how often could this happen, TODAY? In all the
years I wrote IRC programs, I can't recall EVER getting a partial-
line, and in my two years of messing with XMPP, I can't recall EVER
getting a broken stanza. This should only really happen if the packets
get fragmented very badly, someone's on a really bad connection, or
the client is sending half a stanza at a time over TCP. I think that's
the client's problem. The worst thing that could happen is the client
gets booted and has to reconnect. I don't know if this possibility is
worth costing all that performance. How bad could it be if I chose to
simply ignore this and see what happens?
-- rakaur
More information about the JDev
mailing list