Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install collective.plone.gsxml

How to install collective.plone.gsxml

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install collective.plone.gsxml
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.4.7 Available View build log
Windows (64-bit)
0.4.7 Available View build log
Mac OS X (10.5+)
0.4.7 Available View build log
Linux (32-bit)
0.4.7 Available View build log
Linux (64-bit)
0.4.7 Available View build log
Lastest release
version 0.4.7 on Jan 5th, 2011


An XML import/export add-on for Plone.


collective.plone.gsxml is a egg, so installation is easy if you use buildout. You just need to add collective.plone.gsxml to your plone part's eggs AND zcml option.

A example buildout is available here:


This package needs lxml, see the buildout example.


After installation, you'll get two new items in Plone's action menu, one for import, and one for export. For additional stuff, please see the detailled documentation below.


  • Exports virtually all Archetypes-based documents
  • exports and keeps references
  • exports binary data as separate file
  • works with ZOPE blobs
  • sends custom events which you can subscribe to prior and after

System Message: WARNING/2 (<string>, line 39)

Bullet list ends without a blank line; unexpected unindent.

import/export - uses the ZCA to fetch a serializer for a content type -- the default adapter uses the Plone Marshaller


This package relies pretty much on the Marshall product for plone (which is shipped with Plone). This product, is, while offering great functionality, a bit convoluted and does not allow to hook in using the ZCA.

Also, this package tries to export references, and this is currently done using pickles, which is not safe. References should be exported by using adapters defined by those who actually use the references and know how to export them (it's impossible to do this in a generic way IMHO).

  • exports references using pickles
  • messes with the internals of the Marshal product due to lack of

System Message: WARNING/2 (<string>, line 62)

Bullet list ends without a blank line; unexpected unindent.

hooks - uses pickles, this is not secure - manifest XML is not yet parsed

  • convoluted code. The code of this package needs cleanup. This will

System Message: WARNING/2 (<string>, line 70)

Bullet list ends without a blank line; unexpected unindent.

be done in due course.

  • This package out-of-the-box export AT based content only, but you

System Message: WARNING/2 (<string>, line 76)

Bullet list ends without a blank line; unexpected unindent.

can provide your own serializer as adapter - This package does NOT export dynamically marked interfaces - This package does NOT export annotations on content


You need the branch version of Products.Marshall to handle the DataGridFields



change line 44 of Products.eXtremeManagement.content.PoiTask to:

System Message: WARNING/2 (<string>, line 92)

Literal block expected; none found.

def getAssignees(self): managers = set() try: for issue in self.getRefs('task_issues'): managers.add(issue.getResponsibleManager()) except: pass return sorted(list(managers))

because the references to the POI issues are fixed on the end of import and are not available when the object is recreated

:: vim: set ft=rst ts=4 sw=4 expandtab tw=78 :

Change history

0.4.7 (2008-12-19)
  • Fixed reference handling after import [ramonski]
0.4.6 (2008-12-16)
  • Fixed tests and moved them into the source package. [seletz]
  • Added fix for PloneArticle.

System Message: WARNING/2 (<string>, line 124)

Bullet list ends without a blank line; unexpected unindent.

Thanks to Freshmilk Entertainment GmbH for sponsoring this. [seletz]

  • Added a events notified for ObjectWillBeExportedEvent, ObjectExportedEvent,

System Message: WARNING/2 (<string>, line 128)

Bullet list ends without a blank line; unexpected unindent.

ObjectWillBeImportedEvent and ObjectImportedEvent. [seletz]

  • Added lxml and libxml2-python to the buildout. Added ZOPE-enabled

System Message: WARNING/2 (<string>, line 132)

Bullet list ends without a blank line; unexpected unindent.

ipython to the buildout. [seletz]

  • Changes package layout to have the sources under src -- this

System Message: WARNING/2 (<string>, line 135)

Bullet list ends without a blank line; unexpected unindent.

allows to have the buildout include development packages during development [seletz]

  • Fix bug wrt. handling of blob fields. These are now treated like the file

System Message: WARNING/2 (<string>, line 139)

Bullet list ends without a blank line; unexpected unindent.

fields. [seletz]

  • Added plone.app.blob to buildout to test for #10 [seletz]
  • Switched buildout to plone 3.2a1 [seletz]
0.4.5 (2008-06-23)
  • More importview work. [seletz]
  • Added missing file. [seletz]
  • Fix typo [seletz]

Detailed Documentation

Exporting content

To test exporting some content, we'll create content:

>>> _ = self.folder.invokeFactory("Folder", "content")
>>> folder = self.folder["content"]
>>> _ = folder.invokeFactory("Document", "doc1", title="A Document")
>>> _ = folder.invokeFactory("Document", "doc2", title="A second Document")
>>> folder.keys()

System Message: ERROR/3 (<string>, line 167)

Inconsistent literal block quoting.

['doc1', 'doc2']

Now we create a export context -- this will act like a container holding the exported data. We'll use the TarballExportContext here:

>>> from collective.plone.gsxml.context import TarballExportContext
>>> export_context = TarballExportContext()

Now we create a exporter object, which will use the export context created above to store the export data, and use the Marshaller to actually marshall content. We initialize the exporter with the root folder which we want to export:

>>> from collective.plone.gsxml.content import XMLContentFSExporter
>>> exporter = XMLContentFSExporter(folder)

Now we're able to start the export. We supply the export context and a folder inside the export context (thus, one export context can be used multiple times by supplying different root folders). We also specify that this is a root-level export:

>>> exporter.export(export_context, "structure", True)

Ok, that's it. The archive stream may now be fetched from the export context:

>>> archive = export_context.getArchiveStream()
>>> archive.seek(0)
Importing content

To test importing, we'll delete the objects exported above:

>>> folder.manage_delObjects(['doc1', 'doc2'])
>>> folder.keys()

System Message: ERROR/3 (<string>, line 204)

Inconsistent literal block quoting.


Now we create a import context, which will hold our exported stream, and a importer, which will use that import context to read marshalled data from:

>>> from collective.plone.gsxml.context import TarballImportContext
>>> import_context = TarballImportContext(archive)

The importer -- we initialize the importer with the target folder:

>>> from collective.plone.gsxml.content import XMLContentFSImporter
>>> importer = XMLContentFSImporter(folder)

Now we start the import. We supply the import context and the root folder within the import context. Also, we indicate that this is indeed a root-level import:

>>> importer.import_(import_context, "structure", True)

We're now able to get the documents again:

>>> folder.keys()

System Message: ERROR/3 (<string>, line 227)

Inconsistent literal block quoting.

['doc1', 'doc2'] >>> folder.doc1.Title() 'A Document'


(in no particular order. These are the nicks on #plone)

  • fschulze
  • magnon
  • ramonski
  • seletz
  • hannosch
  • witsch


Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.