Saving & Restoring Python objects in XML?

Tim Hoffman timh at zute.net
Tue Sep 24 09:10:13 EDT 2002


Hi

Zope does this, you may like to have a look at the export code in zope, 
to get some ideas.

Tim

Tom Bridgman wrote:
> Hello,
> 
> I'm setting up some codes where I want to save the state of the code in
> an XML file at some time and reload it later to continue the processing.
> 
> It's relatively easy to save out the innards of Python objects into XML
> regardless of how the objects are nested.  But what about loading this
> state information back in from the XML file?  
> 
> Is there a way to write the parser handlers and/or other components (I'm
> using PyXML 0.7 and higher) such that they can assemble the required
> objects as they read in the file?  I'm wondering if there is an elegant
> solution that might not be immediately obvious from the 'brute force'
> method I keep coming up with.  I'd prefer to do this using SAX (since
> I've worked with it some), but using DOM is not out of the question if
> it solves the problem in a straightforward way.
> 
> Thanks,
> Tom
> --
> Dr. William T."Tom" Bridgman           Scientific Visualization Studio
> Global Science & Technology, Inc.      NASA/Goddard Space Flight Center
> Email: bridgman at wyeth.gsfc.nasa.gov    Code 935
> Phone: 301-286-1346                    Greenbelt, MD 20771
> FAX:   TBD                             http://svs.gsfc.nasa.gov/





More information about the Python-list mailing list