XML Pulling

October 30, 2002 7:38 AM

Thanks to the guys who pointed me towards the XML Pull Parser. It's not quite what I'm after, but it'll provide a good source of material to steal from while writing my own.

Just to state the problem better, imagine a protocol based loosely on Jabber, where each side is sending the other a stream of XML fragments. The parser would be receiving chunks like “<foo:bar baz="quux">Fish</f”, and it'd need to parse as much as it could, trigger any events based on that parsing (in this case an opening tag and a text section), and then save the remainder until another chunk is delivered. The XML Pull Parser wouldn't quite work because you'd call nextTag, and it'd choke on the incomplete end-tag.

Luckily, I can cheat, write a parser that does just enough to divide the incoming stream into separate (but well-formed) XML messages, and farm the rest off to a full-featured parser.

State machines. Joy.

1 TrackBacks

Listed below are links to blogs that reference this entry: XML Pulling.

TrackBack URL for this entry: http://fishbowl.pastiche.org/mt-tb.cgi/61

TITLE: Parsing XML in chunks URL: http://www.pycs.net/devlog/2002/10/30/#200210301 IP: 203.98.48.150 BLOG NAME: DATE: 10/30/2002 10:24:09 AM TITLE: Parsing XML in chunks URL: http://www.pycs.net/devlog/2002/10/30/#200210301 IP: 203.98.48.150 BLOG NAME: DATE: 10/30/2002 10:24:09 AM Read More

Previously: SAX and Threads and Rock'n'roll

Next: Spamming Advice To All Networks