serialize a class to XML and back

Burak Arslan burak.arslan at arskom.com.tr
Thu May 23 07:16:34 EDT 2013


On 05/23/13 13:37, Schneider wrote:
> Hi list,
>
> how can I serialize a python class to XML? Plus a way to get the class 
> back from the XML?
>
> My aim is to store instances of this class in a database.

Hi,

I'm working on a project called Spyne (http://spyne.io). With one object 
definition, you can serialize to/from xml and save to database via 
SQLAlchemy.

The code generator on the site has examples for RPC and SQL. If you're 
not interested in doing RPC with the resulting document, here's an 
example for just the xml part: 
https://github.com/arskom/spyne/blob/master/examples/xml_utils.py

Best regards,
Burak




More information about the Python-list mailing list