[jdev] parsing xml (xmpp) with ruby

Eric Will rakaur at malkier.net
Fri Oct 3 06:48:54 CDT 2008


On Thu, Oct 2, 2008 at 5:41 PM, Stephan Maka <stephan at spaceboyz.net> wrote:
> 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 don't really know anything about threads. I come from programming
single-threaded C applications that do a lot of socket input/output,
so I'm more the "using asynchronous socket techniques" kind of person.

> 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.

Thanks. I still have a lot of plans to clean it up further. I'm pretty
anal with my code. I started this two years ago, and then stopped for
two years, and when I came back to it I had no idea what it did
anymore, but it only took me a day or so to get it all back in my
brain.

Sorry about sounding snippy in that mail, I was pretty frustrated.
Still am, but I've decided to work on other things until I get a solid
solution for the current issue.

Like I said, I don't really know anything about threading. From what I
understand, doing a blocking read() call in a Ruby thread is going to
block the entire program anyway, because Ruby doesn't do "real"
threads. The only threading I do in xmppd is with the timers, and
those are really simple. I'm guessing it would take a lot of work to
thread it.

As for contributing, my code is totally open and free. I don't care
who uses it in what. I guess technically it's under BSD license. I
haven't done any of the s2s stuff yet. My plan is to get all the c2s
stuff working well, release that as the alpha, and then add the s2s
stuff for the beta.

By the way, my JID is the same as my email.

> Stephan

-- Eric Will // rakaur



More information about the JDev mailing list