[Zope3-dev] Object Serialization Brainstorm
Casey Duncan
c.duncan@nlada.org
Thu, 20 Dec 2001 14:31:58 -0500
Some interesting points have come up regarding Content Objects, XML, DOM and
the usability of Zope with outside tools. This has rekindled an idea that,
although I think is too ambitious for the initial release Zope3, is something
that we should perhaps be mindful of and try to facilitate now as we can for
the future.
The key question is: Is it possible to design the system such that any object
visible in the ZMI could be arbitrarily (and automatically) transformed or
serialized into externally usable XML?
This would allow the following possibilities:
- All Zope objects, where it was meaningful, could be treated as "content".
- Object instances, could be losslessly transferred (or nearly so) through
various protocols, file systems, databases, etc.
- Alternate, non-browser based ZMIs would be much more feasible
- Syndicating Zope content would be a no-brainer
Now, I realize that I can now serialize objects using Import/Export, however
this not of practical use outside of the ZODB, except as a "shipping box".
What I am talking about is more like creating an XML schema based on the
interface of the objects bases class(es) and then populating it with the
instance data automagically. This would differ from regular XML exports in
that it would be organized in an analogous structure to the base class,
rather then structured as the ZODB stores it.
Lets say it was a file, you might have something like:
<object class="OFS.File">
<object class="string" name="id" value="my_text.txt"/>
<object class="string" name="meta_type" value="File"/>
<object class="string" name="content_type" value="Text/Plain"/>
<object class="DateTime" name="modification_time"
repr="2001/12/20 14:04:32.8676 US/Eastern"/>
<object class="OFS.PropertySheet" name="Properties">
<property name="title" type="string">My Text File</property>
<property name="description" type="string">Blah Blah Blah Blah</property>
</object>
<file encoding="8bit" size="xx">The quick brown fox jumps over the lazy
dog</file>
</object>
This may still be a bit too Zope-centric, maybe something a bit less object
centric would be better. Anyhow, I'm not suggesting this is the best schema,
I haven't used XML a great deal myself. And perhaps XML-RPC or SOAP already
does this, or purports to. But if not, it sure would be cool. What stands in
our way? In my mind we need a mechanism in the Interfaces or class to tag
attributes that should be serialized. And provide a way for specialized
objects, like propertysheets to serialize their instance data in their own
way.
/---------------------------------------------------\
Casey Duncan, Sr. Web Developer
National Legal Aid and Defender Association
c.duncan@nlada.org
\---------------------------------------------------/