[jdev] parsing xml (xmpp) with ruby
Eric Will
rakaur at malkier.net
Thu Oct 2 11:25:58 CDT 2008
On Wed, Oct 1, 2008 at 5:42 PM, Stephan Maka <stephan at spaceboyz.net> wrote:
> The parsers are fine. However, staying with one parser and keeping your
> own state per-stream is wrong. Keep one push parser per stream and let
> it care about the stream's state. Then just build the DOM with SAX
> events coming in.
When I was doing it a different way I was told that I need to use one
parser continuously. I can't win, apparently.
> As I already told you, this is perfectly doable with both
> REXML::Parsers::SAX2Parser and libxml-ruby's XML::Parser, the latter one
> in push mode with my recent patch to their list.
I'd like to figure it out with REXML. I am tired of changing to a
different parser every two hours only to be told I'm using the wrong
one by three different people. Ostensibly, there is more than one
"right way," but everyone thinks that theirs is the only way. I've
received a ton of conflicting "you have to do this" statements in this
thread, and I'm only running in circles. I don't know what a "push
parser" is, and Google seems mostly silent on the matter.
I don't see how this is doable in REXML if it raises exceptions on invalid XML.
> 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
> Stephan
-- Eric Will // rakaur --
More information about the JDev
mailing list