[jdev] parsing xml (xmpp) with ruby
Stephan Maka
stephan at spaceboyz.net
Thu Oct 2 16:41:09 CDT 2008
Eric Will wrote:
> > I'd be happy to repair your code if you finally shared it.
>
> The code has been at http://svn.malkier.net/xmppd/ for two years.
>
> If you can figure it out, thanks. The parsing is in
> lib/xmppd/xmpp/parser.rb and lib/xmppd/xmpp/stream.rb
Oh, I didn't know that. I now realize that you are using no threads.
Obviously REXML's sax2parser is an endless loop which only breaks on EOF
and loses all state then.
There are three solutions:
* Either use threads like in XMPP4R
* Or use libxml-ruby's sax2parser with my patch
* Make your own - interruptable - version of sax2parser, using REXML's
BaseParser
I'm sorry I confused you, you should have pointed at the code earlier.
BTW, I like the code, it looks clean. If you decide to take the
threading path, please consider contributing to XMPP4R. S2S is useful
for more than just standard user servers.
Stephan
More information about the JDev
mailing list