[Zope3-dev] Object Serialization Brainstorm

Martijn Faassen faassen@vet.uu.nl
Fri, 21 Dec 2001 23:58:03 +0100


Lennart Regebro wrote:
> > I think it can be done.
> 
> I still don't see how. What can be done though, is to have a standardized
> interface for XML import/export that each class could without too much
> trouble make it's own adapter for. This means that if you need XML
> import/export for a class, it will be easy to do it.
> 
> But I don't think it can be done automatically in any way that is
> particularily more useful than the XML export of today.

I think some of it could be made more clean, as content objects may
be able to say more about the way they're constructed, but overall I
agree with this.

And I also agree it's possible to make a set of adapters that give DOM
interfaces for common Zope interfaces, and thus you can serialize to
clean XML. A lot more difficult is the reverse direction; turning the
XML into Zope objects again (or in fact perhaps changing existing
Zope objects). Even just a read-only DOMish view on the ZODB would
be useful for querying purposes though, such as with XPath.

This isn't a new idea, see for instance:

http://dev.zope.org/Wikis/DevSite/Proposals/ZDOMXPath

which refers to older proposals involving a ZDOM in the Zope-XML wiki.
There's in fact a non-compliant pretty broken implementation of ZDOM
inside Zope right now, in lib/python/OFS/ZDOM.py. :)

The hard part, again, is the reverse direction; it touches upon
versioning and a lot of other stuff. This needs to be thought about a lot
more for any good filesystem mirroring of the ZODB to become useful.

Regards,

Martijn