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. > If you ask me, you could do easy with a simple header line like: > > parrot xml 1.0 > \0 > > basically magic word ('parrot') > followed by a space > followed by the type > followed by a space > followed by version > followed by a CRLF (not sure about this one, but could be nice) > followed by a null byte That works for me, including the crlf. Congrats, you just defined the parrot serialization header tag! :-) > I'm not clear if you would know beforehand how many bytes of data you > would receive. If that is possible to know at all time, then I would > suggest having the length as an extra part of the header. Since we're going to potentially be serializing to an on-the-fly unseekable device (i.e. dumping to a socket) so no length. > >In that case, nuts to that. It's already terribly obvious I'm going to > >mess it up if I try, so we'll just skip it and move on to the next > >headache. :) > > Which means I'll be going back to lurking mode again... ;-) Waiting to pounce, huh? :) Dan