[jdev] parsing xml (xmpp) with ruby

Eric Will rakaur at malkier.net
Wed Oct 1 14:15:30 CDT 2008


On Wed, Oct 1, 2008 at 3:00 PM, Remko Tronçon <remko at el-tramo.be> wrote:
> That's a server limit you have to pick. I don't really see what that
> limit would have to do with the read() buffer size, it's completely
> independent.

My correlation was that the max buffer size could be a certain number
of read()s, based on the read() buffer size.

> To me, this means that you haven't solved the problem correctly, and
> that you're still using the wrong type of parser that expects your
> document to be complete. A real incremental parser never throws an
> exception on an incomplete piece of XML of any kind. I'm also doubting
> that you have the right test set to assume that your parser works.

I've run out of XML parsers to use. What do you use? Ruby's REXML
SAX2Parser raises an exception on malformed XML. libxml's SaxParser
calls parser_error in the receiver, and requires a root element,
starting and closing. That's an entire document, and yet one of the
most widely used SaxParsers is libxml. There are no expat bindings for
Ruby.

If REXML finds this it raises an exception and stops parsing. If
libxml finds this is calls on_parser_error with a useless string and
keeps on parsing. libxml assumes the first element is the root
element, and if there's no closing tag for that element before the end
of the document it calls on_parser_error. I can ignore both of these
conditions, but if I do that then I have no way to detect malformed
XML. If your program doesn't have these problems, then what parser are
you using? What type of parser, what library? Apparently it's very
special.

> cheers,
> Remko

-- Eric Will // rakaur --



More information about the JDev mailing list