[jdev] parsing xml (xmpp) with ruby

Norman Rasmussen norman at rasmussen.co.za
Sat Sep 27 16:06:07 CDT 2008


On Sat, Sep 27, 2008 at 9:28 PM, Eric Will <rakaur at malkier.net> wrote:

> [...] I have to wrap every
> incoming chunk of XMPP with my own <root/> tag, and then ignore that
> after REXML parses it. I am currently unhappy with this approach.
>

What happens in the incoming data chunk isn't well formed XML, do you cache
it somehow?

If I ever had to write my own xmpp parser, I would use a SAX like parser to
isolate the elements from the input stream, so I knew that they were well
formed, and then I would put them into a fake XML document using the stream
element.  i.e. use the stream stanza from the opening of the stream - that
way you get the namespace declarations right for free and element.parent is
'valid'.

-- 
- Norman Rasmussen
- Email: norman at rasmussen.co.za
- Home page: http://norman.rasmussen.co.za/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20080927/8bdd01fe/attachment-0002.htm>


More information about the JDev mailing list