[jdev] parsing xml (xmpp) with ruby

Eric Will rakaur at malkier.net
Tue Sep 30 10:42:13 CDT 2008


On Tue, Sep 30, 2008 at 9:57 AM, Remko Tronçon <remko at el-tramo.be> wrote:
> Hmm, how can a SAX parser complain about a partial XML file? SAX *is*
> incremental. It would probably help if you described in a high level
> how your parser works, how you feed it data, ...

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.

> Remko
> _______________________________________________
> 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
> _______________________________________________
>

-- rakaur



More information about the JDev mailing list