XML Marshalling of objects
David Bolen
db3l at fitlinxx.com
Wed Oct 3 16:41:14 EDT 2001
Markus Schaber <markus at schabi.de> writes:
> <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.
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list