diff --git a/pyecore/resources/xmi.py b/pyecore/resources/xmi.py
index <HASH>..<HASH> 100644
--- a/pyecore/resources/xmi.py
+++ b/pyecore/resources/xmi.py
@@ -160,7 +160,10 @@ class XMIResource(Resource):
             annotation_value = node.get('value')
             parent_eobj.details[annotation_key] = annotation_value
             if annotation_key == 'documentation':
-                parent_eobj.eContainer().__doc__ = annotation_value
+                container = parent_eobj.eContainer()
+                if hasattr(container, 'python_class'):
+                    container = container.python_class
+                container.__doc__ = annotation_value
             return (None, None, [], [])
         else:
             eobject = etype()
Add finer support for documentation on dynamic metamodel

The documentation is added to the Python class linked to an EClass
instance. This way, each time 'help' is called on a model element
instance, the right documentation is displayed. This documentation is
fetched from the '.ecore' metamodel, from one of the entry of
EAnnotations associated to the metaclass.