XML Marshalling of objects

Skip Montanaro skip at pobox.com
Tue Oct 2 10:24:07 EDT 2001


    Peter> I'm wondering if there is a good way to marshal/unmarshal python
    Peter> objects to XML? ...  Is xml-rpc the right way to go?

Depends on what you want.  If you use xmlrpclib.dumps you will be able to
serialize many Python datatypes, but there are some caveats:

    1. Tuples and lists both serialize to <array>.

    2. Serialization of classes and instances is not supported.

That said, you should be able to use the code in xmlrpclib as the basis to
create a better mapping between Python objects and XML.  (Just be careful
not to call it XML-RPC.  You'll get reamed by the XML-RPC folks -- one folk
in particular.)

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list