XML Marshalling of objects

Markus Schaber markus at schabi.de
Wed Oct 3 16:53:11 EDT 2001


Hello,

David Bolen <db3l at fitlinxx.com> schrub:

>> <xml "dtd-declaration here">
>> <pickled_data>Here just follows the data stream from
>> pickle()</pickled_data>
>> </xml>
>> 
>> Just write the two-liner dtd for it, and you have pickle outputting
>> valid xml, and with almost no speed loss :-)
> 
> Even if you make the pickled_data element in your DTD a CDATA you're
> going to have to post-process the pickle output to ensure it doesn't
> include any characters that need to be quoted as entities in the XML
> stream (e.g., "<").  Then of course, you've to to invert this on the
> other side, so there's going to be some cost to the encoding/decoding.
> 
> Might almost be better to use the binary pickle form, and then base64
> encode it, since that should be safe for an XML element content.

That's correct, of course. 

mar "Never thought anyone would take this serious" kus
-- 
You don't have to be Microsoft to suck... but it helps.
(Tim Hammerquist in comp.lang.python)



More information about the Python-list mailing list