Serialize to XML / Deserialize from XML (moin 2.x)

We need (de-)serialization at quite some places:

Ideas for serialization format

Complete dump

<wiki>
 <meta>
 ... (wiki-level metadata) ...
 </meta>
 <items>
  ... (items) ...
 </items>
</wiki>

Item serialization (1 complete item)

<item type="user|data" name="...">
 <meta>
 ... (item-level metadata) ...
 </meta>
 <revision revno="0">
  <meta>
  ... (revision-level metadata) ...
  </meta>
  <data>
  ... (revision data) ...
  </data>
 </revision>
 ... (more revisions) ...
</item>

Metadata representation

<meta>
 <entry name="key1">value1</entry>
 <entry name="key2">value2</entry>
 ...
</meta>

Data representation and dealing with large data

As we store arbitrary binary items, stuff can easily get rather big (e.g. if someone attaches a CD or DVD image, maybe even in multiple revisions).

Embedding chunked revision data

ElementTree (and also EmeraldTree) does not seem to support data streaming (i.e. we can't read item data chunk-wise and write it to a single xml element).

But we can create multiple data-chunk elements, like:

<data>
 <chunk>... 100kB data ...</chunk>
 <chunk>... 100kB data ...</chunk>
 <chunk>... 42kB data (== the rest)...</chunk>
</data>

The data inside the chunk could be base64-encoded to support all item mimetypes in the same way.

Referring to revision data

Integrity checking

Data integrity can be checked using the hash we have in the metadata.

Serializer features

See also


CategoryFeatureRequest

MoinMoin: FeatureRequests/XmlSerialisation (last edited 2009-06-15 12:21:40 by ThomasWaldmann)