[Zope] Zope Database in XML
Jim Fulton
jim@digicool.com
Tue, 23 Mar 1999 14:44:09 -0500
A side project of mine is to allow conversion to and from
Zope databases (and export files) and XML. This will allow
people to more easily access their data without Zope and correct
problems, such as moved or renamed software modules, that prevent
data from being unpicklable.
I've completed a first cut at a tool for converting a Zope
database to XML format. It is provided in the file 'bbb.py'
in a 'utilities' directory that will be included in the
distribution directory of the next Zope release.
If you want to get this now, you can get it via Zope
public CVS access. See
http://www.zope.org/Community/Services/CVS_public_access
for details.
To run the tool, use:
python utilities/bbb.py -rxml var/Data.bbb
For now, the tool provides a way to "get at"
your data without Zope and get a bit more of an idea
of how Zope organizes data in the database.
The file uses a module 'ppml.py' (Python
pickle markup language :) that must by in the
same directory as bbb.py or in the Python path.
ppml.py provides for conversion from Python pickles
to XML. It will eventually provide conversion
from XML to Python pickles. Comments from members
of the XML SIG (those who happen to spend time here
too) would be welcome. I haven't written a formal DTD
for this XML format. I would like to use a standard Python
XML pickle format, but I'm not sure if such a thing exists
yet.
I took the approach of conversion to and from Python pickle
format for two reasons:
- It allows me to do conversion to and from
database format without actually creating any
(application objects). This is much faster than
creating actual objects and does not require that
any application Python modules needed to unpickle
objects be around or working. For example, this allows
conversion of objects that are not unpicklable.
- It means that many of the implementation details
of pickling can be avoided.
Of course, in combination with the Python pickle modules,
pickling objects to XML is straightforward:
import pickle, ppml
print ppml.ToXMLloads(pickle.dumps(myobject))
Enjoy.
Jim
--
Jim Fulton mailto:jim@digicool.com Python Powered!
Technical Director (888) 344-4332 http://www.python.org
Digital Creations http://www.digicool.com http://www.zope.org
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission. Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.