On Oct 21, 2003, at 10:49 AM, Dan Sugalski wrote:

On Tue, 21 Oct 2003, Elizabeth Mattijsen wrote:

At 12:53 -0400 10/21/03, Dan Sugalski wrote:
Yeah, if you're just needing to tag the stream with a label to indicate
the type plus a version number, then xml's on the one hand overkill and
on the other hand not necessarily a big help to xml proponents.
So, in a nutshell, throwing an XML format type tag at the beginning buys
us nothing regardless of whether it's an XML stream or not?

Yep. But mainly I think because you'll need to encode binary data to make it valid XML. That's on overhead you don't to suffer for those serialization that don't need it.

I had it in mind that the XML parsers were all event driven so they'd read
the header and stop until prodded, and wouldn't be prodded on if it wasn't
a real parrot XML serialization stream, so binary data wouldn't matter.

The event-based parsers (such as expat and other SAX parsers) tend to be push instead of pull, so you hand them your bytes and they invoke your callbacks (as opposed to pull-style in which you'd ask for the next event). Sometimes you can hand them your bytes in chunks (and they'll process what they can and save up the rest to include with your next chunk), so with expat (for example) you could probably do what you wanted, but you'd have to hand it data one byte at a time until your first callback was invoked, then stop. So it could probably be done with some parsers, but it would be an unusual usage, and more overhead than it's worth to just parse out a couple of strings. :)


JEff



Reply via email to