[jdev] parsing xml (xmpp) with ruby

Jonathan Dickinson jonathan.dickinson at k2.com
Wed Oct 1 00:29:49 CDT 2008


I can give you a XML parser in C# that you can port. I have had no problems with it so far and I have been using it for a couple of months.

> -----Original Message-----
> From: jdev-bounces at jabber.org [mailto:jdev-bounces at jabber.org] On
> Behalf Of Stephan Maka
> Sent: Wednesday, October 01, 2008 2:40 AM
> To: jdev at jabber.org
> Subject: Re: [jdev] parsing xml (xmpp) with ruby
>
> Eric Will wrote:
> > It doesn't complain about a partial file. If I pass it a partial
> > stanza, with say the end tag only halfway finished, like "</prese" it
> > raises an exception. The exception tells me nothing that I can use to
> > isolate the incomplete stanza and save it to be appended onto later.
> >
> > I feed it data that I pull out of the socket's read() method. It has
> > listeners for start tags, text, and end tags. The method that handles
> > the start tag sets everything up, and starts to build a tree. The end
> > tag method passes the tree to a handler function.
>
> If you stick to REXML (which you shouldn't if you aim for performance)
> you should read XMPP4R's streamparser.rb. The usage of REXML's SAX2
> parser is really straight-forward there.
>
> If you're using libxml-ruby then I recognize your problem. The key is
> using the parser in "push mode". Take a look at the last patch I sent
> to
> their list.
>
> Don't explain that much, but share your code.
>
>
> Stephan
> _______________________________________________
> JDev mailing list
> FAQ: http://www.jabber.org/discussion-lists/jdev-faq
> Forum: http://www.jabberforum.org/forumdisplay.php?f=20
> Info: http://mail.jabber.org/mailman/listinfo/jdev
> Unsubscribe: JDev-unsubscribe at jabber.org
> _______________________________________________



More information about the JDev mailing list