> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Eric Will > Sent: Thursday, October 02, 2008 6:26 PM > To: Jabber/XMPP software development list > Subject: Re: [jdev] parsing xml (xmpp) with ruby > > ... I don't know what a "push > parser" is, and Google seems mostly silent on the matter. >
A push parser is one of those dark arcane wizardry type things. Most of the time it's (incorrectly, IIRC) called a SAX parser. Essentially it comes down to a very crucial difference, which I will demonstrate in pseudo code. So our classical XML reader: Set stream = create stream that reads from network client Set parser = create parser that reads from 'stream' While 'parser' has more nodes Set node = next node from 'parser' Do something with 'node' End while Our push mode one: Set stream = create stream that reads from network client Set parser = create parser Assign parser event called 'Element Started' to method 'My Element Started' While 'stream' has more data (typically threaded or such, but this is pseudo-code) Set data = read data from 'stream' Call 'push' method on 'parser' giving it 'data' End while Method 'My Element Started' that takes one Xml Node parameter called 'node' Do something with 'node' End Method Hopefully that explains the difference. The parser is optimized so that I can efficiently handle incomplete documents, without being under the strain of always having to return a node. > > > Stephan > > -- Eric Will // rakaur -- > _______________________________________________ > 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: [EMAIL PROTECTED] > _______________________________________________ _______________________________________________ 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: [EMAIL PROTECTED] _______________________________________________