Manifest
========

We first need to do some imports::

    >>> from collective.plone.gsxml import manifest
    >>> from StringIO import StringIO

Writer
---------

Preparing the manifest::

    >>> stream = StringIO()
    >>> xml_writer = manifest.ManifestWriter( stream )
    >>> xml_writer
    <collective.plone.gsxml.manifest.ManifestWriter object at ...>

For writing an xml record in the manifest, we need to give its 'add' method
the object id and the object type::

    >>> xml_writer.add( 'toto', 'Document' )

We do it  again for having a bunch of elements::

    >>> xml_writer.add( 'lulu', 'Document' )

We see what we have in the manifest::

    >>> data = xml_writer.getvalue()
    >>> print data
    <manifest>
    <record type="Document"> toto </record>
    <record type="Document"> lulu </record>
    </manifest>
    <BLANKLINE>

lets make sure it's closed now::

    >>> print xml_writer.closed
    True

Reader
---------

**data** is our file content::

    >>> print data
    <manifest>
    <record type="Document"> toto </record>
    <record type="Document"> lulu </record>
    </manifest>
    <BLANKLINE>

What can we do with our reader?::

    >>> xml_reader = manifest.ManifestReader( data )
    >>> xml_reader
    <collective.plone.gsxml.manifest.ManifestReader object at ...>
    >>> for i in xml_reader:
    ...     print i
    (u'toto', u'Document')
    (u'lulu', u'Document')

Note: Its passing because we have more than one elements in the file.
It fails if we have only one (non iteration problem).
This should be fixed.
