libxml-ruby's SAX parser interface is only of limited use currently. The
reason is that the document to be parsed must be passed as a whole. This
is somewhat contrary to the actual reason for the use of a SAX parser.
The attached patch adds a new constructor to use the parser in the
so-called "push mode" where it won't complain about the document to be
unfinished when parsing subsequent parts of it.

My goal was the parsing of a network XML stream (XMPP). Here, the
document is being provided continually over time and I need the SAX
events long before the document ends. :-)

Unfortunately, the libxml parser seems to buffer a lot and I don't
receive all events of the current string immediately. This behaviour
renders it unsuitable for XMPP and I will stick to the apparently
antique expat binding unless someone comes up with a better idea.

Does the underlying libxml library support this usage? If yes, then I'm sure we can figure out how to support it.

I do wonder though - if you're parsing xml as it is streamed in, how do you avoid ill-formed xml (say only partially finished elements "</f?

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to