Serialize FormalExpression.body according to XSD

The implementation is similar to the one for Documentation.text. The
body attribute is computed from the mixed property and serialized only
in XMI, while the mixed content itself is serialized when saving as
pure XML.

body was changed from an EAttribute of type EObject to an EReference
of type EString, leading to a XMI serialization as XML attribute,
which is not strictly valid. Thus, the corresponding test still fails.

Bug: 323168
diff --git a/org.eclipse.bpmn2.edit/plugin.properties b/org.eclipse.bpmn2.edit/plugin.properties
index 0156488..367fddb 100644
--- a/org.eclipse.bpmn2.edit/plugin.properties
+++ b/org.eclipse.bpmn2.edit/plugin.properties
@@ -759,3 +759,4 @@
 _UI_InteractionNode_outgoingConversationLinks_description = (limited to flow elements which have been loaded into this resource set)

 _UI_ExtensionAttributeValue_any_feature = Any

 _UI_BaseElement_anyAttribute_feature = Any Attribute

+_UI_FormalExpression_mixed_feature = Mixed

diff --git a/org.eclipse.bpmn2.edit/src/org/eclipse/bpmn2/provider/FormalExpressionItemProvider.java b/org.eclipse.bpmn2.edit/src/org/eclipse/bpmn2/provider/FormalExpressionItemProvider.java
index d82c0c7..4dfbafe 100644
--- a/org.eclipse.bpmn2.edit/src/org/eclipse/bpmn2/provider/FormalExpressionItemProvider.java
+++ b/org.eclipse.bpmn2.edit/src/org/eclipse/bpmn2/provider/FormalExpressionItemProvider.java
@@ -22,6 +22,10 @@
 import org.eclipse.bpmn2.FormalExpression;

 import org.eclipse.emf.common.notify.AdapterFactory;

 import org.eclipse.emf.common.notify.Notification;

+import org.eclipse.emf.ecore.EStructuralFeature;

+import org.eclipse.emf.ecore.util.FeatureMapUtil;

+import org.eclipse.emf.ecore.xml.type.XMLTypeFactory;

+import org.eclipse.emf.ecore.xml.type.XMLTypePackage;

 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;

 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;

 import org.eclipse.emf.edit.provider.IItemLabelProvider;

@@ -76,15 +80,14 @@
      * @generated

      */

     protected void addBodyPropertyDescriptor(Object object) {

-        itemPropertyDescriptors

-                .add(createItemPropertyDescriptor(

-                        ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),

-                        getResourceLocator(),

-                        getString("_UI_FormalExpression_body_feature"),

-                        getString("_UI_PropertyDescriptor_description",

-                                "_UI_FormalExpression_body_feature", "_UI_FormalExpression_type"),

-                        Bpmn2Package.Literals.FORMAL_EXPRESSION__BODY, true, false, true, null,

-                        null, null));

+        itemPropertyDescriptors.add(createItemPropertyDescriptor(

+                ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),

+                getResourceLocator(),

+                getString("_UI_FormalExpression_body_feature"),

+                getString("_UI_PropertyDescriptor_description",

+                        "_UI_FormalExpression_body_feature", "_UI_FormalExpression_type"),

+                Bpmn2Package.Literals.FORMAL_EXPRESSION__BODY, true, false, true,

+                ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));

     }

 

     /**

@@ -123,6 +126,36 @@
     }

 

     /**

+     * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an

+     * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or

+     * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.

+     * <!-- begin-user-doc -->

+     * <!-- end-user-doc -->

+     * @generated

+     */

+    @Override

+    public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {

+        if (childrenFeatures == null) {

+            super.getChildrenFeatures(object);

+            childrenFeatures.add(Bpmn2Package.Literals.FORMAL_EXPRESSION__MIXED);

+        }

+        return childrenFeatures;

+    }

+

+    /**

+     * <!-- begin-user-doc -->

+     * <!-- end-user-doc -->

+     * @generated

+     */

+    @Override

+    protected EStructuralFeature getChildFeature(Object object, Object child) {

+        // Check the type of the specified child object and return the proper feature to use for

+        // adding (see {@link AddCommand}) it as a child.

+

+        return super.getChildFeature(object, child);

+    }

+

+    /**

      * This returns FormalExpression.png.

      * <!-- begin-user-doc -->

      * <!-- end-user-doc -->

@@ -168,6 +201,10 @@
             fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(),

                     false, true));

             return;

+        case Bpmn2Package.FORMAL_EXPRESSION__MIXED:

+            fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(),

+                    true, false));

+            return;

         }

         super.notifyChanged(notification);

     }

@@ -182,6 +219,27 @@
     @Override

     protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {

         super.collectNewChildDescriptors(newChildDescriptors, object);

+

+        newChildDescriptors.add(createChildParameter(

+                Bpmn2Package.Literals.FORMAL_EXPRESSION__MIXED, FeatureMapUtil.createEntry(

+                        XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, "")));

+

+        newChildDescriptors.add(createChildParameter(

+                Bpmn2Package.Literals.FORMAL_EXPRESSION__MIXED, FeatureMapUtil.createEntry(

+                        XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT, "")));

+

+        newChildDescriptors.add(createChildParameter(

+                Bpmn2Package.Literals.FORMAL_EXPRESSION__MIXED, FeatureMapUtil.createEntry(

+                        XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__PROCESSING_INSTRUCTION,

+                        XMLTypeFactory.eINSTANCE.createProcessingInstruction())));

+

+        newChildDescriptors.add(createChildParameter(

+                Bpmn2Package.Literals.FORMAL_EXPRESSION__MIXED, FeatureMapUtil.createEntry(

+                        XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA, "")));

+

+        newChildDescriptors.add(createChildParameter(

+                Bpmn2Package.Literals.FORMAL_EXPRESSION__MIXED,

+                FeatureMapUtil.createEntry(Bpmn2Package.Literals.FORMAL_EXPRESSION__BODY, "")));

     }

 

 }

diff --git a/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java b/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java
index 82e0ae8..3bf4fce 100644
--- a/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java
+++ b/org.eclipse.bpmn2.tests/src/org/eclipse/bpmn2/tests/XMISerializationTest.java
@@ -113,6 +113,9 @@
     @Override
     protected void checkSerializationFormalExpBody(Resource res) throws SAXException, IOException,
             ParserConfigurationException {
+        /*
+         * TODO: this check fails currently - the body is stored as an attribute (see bug 323168) 
+         */
         DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
         Document xml = fact.newDocumentBuilder().parse(new File(res.getURI().toFileString()));
         Node scriptNode = xml.getElementsByTagName("condition").item(0);
diff --git a/org.eclipse.bpmn2/model/BPMN20.ecore b/org.eclipse.bpmn2/model/BPMN20.ecore
index 9503330..d1edebf 100644
--- a/org.eclipse.bpmn2/model/BPMN20.ecore
+++ b/org.eclipse.bpmn2/model/BPMN20.ecore
@@ -1525,7 +1525,7 @@
         <details key="name" value="extensionElements"/>
         <details key="namespace" value="http://www.omg.org/spec/BPMN/20100524/MODEL"/>
       </eAnnotations>
-    </eStructuralFeatures>        
+    </eStructuralFeatures>
     <eStructuralFeatures xsi:type="ecore:EReference" name="documentation" ordered="false"
         upperBound="-1" eType="#//Documentation" containment="true">
       <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
@@ -1533,10 +1533,9 @@
         <details key="name" value="documentation"/>
         <details key="namespace" value="http://www.omg.org/spec/BPMN/20100524/MODEL"/>
       </eAnnotations>
-    </eStructuralFeatures>        
-    <eStructuralFeatures xsi:type="ecore:EReference" name="extensionDefinitions" ordered="false"
-        upperBound="-1" eType="#//ExtensionDefinition">
     </eStructuralFeatures>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="extensionDefinitions" ordered="false"
+        upperBound="-1" eType="#//ExtensionDefinition"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" ordered="false" lowerBound="1"
         eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" iD="true">
       <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
@@ -1553,7 +1552,6 @@
         <details key="processing" value="lax"/>
       </eAnnotations>
     </eStructuralFeatures>
-    
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="BoundaryEvent" eSuperTypes="#//CatchEvent">
     <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
@@ -2725,8 +2723,8 @@
     <eStructuralFeatures xsi:type="ecore:EReference" name="valueRef" ordered="false"
         eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject" transient="true"
         derived="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="value" ordered="false" upperBound="-1"
-        eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"
+    <eStructuralFeatures xsi:type="ecore:EReference" name="value" ordered="false"
+        upperBound="-1" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"
         containment="true">
       <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
         <details key="kind" value="elementWildcard"/>
@@ -2734,7 +2732,7 @@
         <details key="name" value=":0"/>
         <details key="processing" value="lax"/>
       </eAnnotations>
-    </eStructuralFeatures>              
+    </eStructuralFeatures>
     <eStructuralFeatures xsi:type="ecore:EReference" name="extensionAttributeDefinition"
         ordered="false" lowerBound="1" eType="#//ExtensionAttributeDefinition" transient="true"
         derived="true"/>
@@ -2832,8 +2830,15 @@
       <details key="name" value="tFormalExpression"/>
       <details key="kind" value="mixed"/>
     </eAnnotations>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="body" ordered="false" lowerBound="1"
-        eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject" transient="true"
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" unique="false" upperBound="-1"
+        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
+      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
+        <details key="kind" value="elementWildcard"/>
+        <details key="name" value=":mixed"/>
+      </eAnnotations>
+    </eStructuralFeatures>
+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="body" ordered="false" lowerBound="1"
+        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" volatile="true"
         derived="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="evaluatesToTypeRef" ordered="false"
         lowerBound="1" eType="#//ItemDefinition">
diff --git a/org.eclipse.bpmn2/model/BPMN20.genmodel b/org.eclipse.bpmn2/model/BPMN20.genmodel
index dff588b..a4d30bd 100644
--- a/org.eclipse.bpmn2/model/BPMN20.genmodel
+++ b/org.eclipse.bpmn2/model/BPMN20.genmodel
@@ -229,6 +229,7 @@
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference BPMN20.ecore#//BaseElement/documentation"/>

       <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference BPMN20.ecore#//BaseElement/extensionDefinitions"/>

       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute BPMN20.ecore#//BaseElement/id"/>

+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute BPMN20.ecore#//BaseElement/anyAttribute"/>

     </genClasses>

     <genClasses ecoreClass="BPMN20.ecore#//BoundaryEvent">

       <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference BPMN20.ecore#//BoundaryEvent/attachedToRef"/>

@@ -470,7 +471,8 @@
       <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference BPMN20.ecore#//FlowNode/outgoing"/>

     </genClasses>

     <genClasses ecoreClass="BPMN20.ecore#//FormalExpression">

-      <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference BPMN20.ecore#//FormalExpression/body"/>

+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute BPMN20.ecore#//FormalExpression/mixed"/>

+      <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EAttribute BPMN20.ecore#//FormalExpression/body"/>

       <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference BPMN20.ecore#//FormalExpression/evaluatesToTypeRef"/>

       <genFeatures createChild="false" ecoreFeature="ecore:EAttribute BPMN20.ecore#//FormalExpression/language"/>

     </genClasses>

diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/Bpmn2Package.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/Bpmn2Package.java
index a668152..19417d2 100644
--- a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/Bpmn2Package.java
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/Bpmn2Package.java
@@ -9717,13 +9717,22 @@
     int FORMAL_EXPRESSION__ANY_ATTRIBUTE = EXPRESSION__ANY_ATTRIBUTE;
 
     /**
-     * The feature id for the '<em><b>Body</b></em>' reference.
+     * The feature id for the '<em><b>Mixed</b></em>' attribute list.
      * <!-- begin-user-doc -->
      * <!-- end-user-doc -->
      * @generated
      * @ordered
      */
-    int FORMAL_EXPRESSION__BODY = EXPRESSION_FEATURE_COUNT + 0;
+    int FORMAL_EXPRESSION__MIXED = EXPRESSION_FEATURE_COUNT + 0;
+
+    /**
+     * The feature id for the '<em><b>Body</b></em>' attribute.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     * @ordered
+     */
+    int FORMAL_EXPRESSION__BODY = EXPRESSION_FEATURE_COUNT + 1;
 
     /**
      * The feature id for the '<em><b>Evaluates To Type Ref</b></em>' reference.
@@ -9732,7 +9741,7 @@
      * @generated
      * @ordered
      */
-    int FORMAL_EXPRESSION__EVALUATES_TO_TYPE_REF = EXPRESSION_FEATURE_COUNT + 1;
+    int FORMAL_EXPRESSION__EVALUATES_TO_TYPE_REF = EXPRESSION_FEATURE_COUNT + 2;
 
     /**
      * The feature id for the '<em><b>Language</b></em>' attribute.
@@ -9741,7 +9750,7 @@
      * @generated
      * @ordered
      */
-    int FORMAL_EXPRESSION__LANGUAGE = EXPRESSION_FEATURE_COUNT + 2;
+    int FORMAL_EXPRESSION__LANGUAGE = EXPRESSION_FEATURE_COUNT + 3;
 
     /**
      * The number of structural features of the '<em>Formal Expression</em>' class.
@@ -9750,7 +9759,7 @@
      * @generated
      * @ordered
      */
-    int FORMAL_EXPRESSION_FEATURE_COUNT = EXPRESSION_FEATURE_COUNT + 3;
+    int FORMAL_EXPRESSION_FEATURE_COUNT = EXPRESSION_FEATURE_COUNT + 4;
 
     /**
      * The meta object id for the '{@link org.eclipse.bpmn2.impl.GlobalTaskImpl <em>Global Task</em>}' class.
@@ -21869,15 +21878,26 @@
     EClass getFormalExpression();
 
     /**
-     * Returns the meta object for the reference '{@link org.eclipse.bpmn2.FormalExpression#getBody <em>Body</em>}'.
+     * Returns the meta object for the attribute list '{@link org.eclipse.bpmn2.FormalExpression#getMixed <em>Mixed</em>}'.
      * <!-- begin-user-doc -->
      * <!-- end-user-doc -->
-     * @return the meta object for the reference '<em>Body</em>'.
+     * @return the meta object for the attribute list '<em>Mixed</em>'.
+     * @see org.eclipse.bpmn2.FormalExpression#getMixed()
+     * @see #getFormalExpression()
+     * @generated
+     */
+    EAttribute getFormalExpression_Mixed();
+
+    /**
+     * Returns the meta object for the attribute '{@link org.eclipse.bpmn2.FormalExpression#getBody <em>Body</em>}'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @return the meta object for the attribute '<em>Body</em>'.
      * @see org.eclipse.bpmn2.FormalExpression#getBody()
      * @see #getFormalExpression()
      * @generated
      */
-    EReference getFormalExpression_Body();
+    EAttribute getFormalExpression_Body();
 
     /**
      * Returns the meta object for the reference '{@link org.eclipse.bpmn2.FormalExpression#getEvaluatesToTypeRef <em>Evaluates To Type Ref</em>}'.
@@ -27593,12 +27613,20 @@
         EClass FORMAL_EXPRESSION = eINSTANCE.getFormalExpression();
 
         /**
-         * The meta object literal for the '<em><b>Body</b></em>' reference feature.
+         * The meta object literal for the '<em><b>Mixed</b></em>' attribute list feature.
          * <!-- begin-user-doc -->
          * <!-- end-user-doc -->
          * @generated
          */
-        EReference FORMAL_EXPRESSION__BODY = eINSTANCE.getFormalExpression_Body();
+        EAttribute FORMAL_EXPRESSION__MIXED = eINSTANCE.getFormalExpression_Mixed();
+
+        /**
+         * The meta object literal for the '<em><b>Body</b></em>' attribute feature.
+         * <!-- begin-user-doc -->
+         * <!-- end-user-doc -->
+         * @generated
+         */
+        EAttribute FORMAL_EXPRESSION__BODY = eINSTANCE.getFormalExpression_Body();
 
         /**
          * The meta object literal for the '<em><b>Evaluates To Type Ref</b></em>' reference feature.
diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/FormalExpression.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/FormalExpression.java
index 7e1d5ae..d52175b 100644
--- a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/FormalExpression.java
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/FormalExpression.java
@@ -14,6 +14,8 @@
  */
 package org.eclipse.bpmn2;
 
+import org.eclipse.emf.ecore.util.FeatureMap;
+
 /**
  * <!-- begin-user-doc -->
  * A representation of the model object '<em><b>Formal Expression</b></em>'.
@@ -22,6 +24,7 @@
  * <p>
  * The following features are supported:
  * <ul>
+ *   <li>{@link org.eclipse.bpmn2.FormalExpression#getMixed <em>Mixed</em>}</li>
  *   <li>{@link org.eclipse.bpmn2.FormalExpression#getBody <em>Body</em>}</li>
  *   <li>{@link org.eclipse.bpmn2.FormalExpression#getEvaluatesToTypeRef <em>Evaluates To Type Ref</em>}</li>
  *   <li>{@link org.eclipse.bpmn2.FormalExpression#getLanguage <em>Language</em>}</li>
@@ -34,30 +37,47 @@
  */
 public interface FormalExpression extends Expression {
     /**
-     * Returns the value of the '<em><b>Body</b></em>' reference.
+     * Returns the value of the '<em><b>Mixed</b></em>' attribute list.
+     * The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}.
+     * <!-- begin-user-doc -->
+     * <p>
+     * If the meaning of the '<em>Mixed</em>' attribute list isn't clear,
+     * there really should be more of a description here...
+     * </p>
+     * <!-- end-user-doc -->
+     * @return the value of the '<em>Mixed</em>' attribute list.
+     * @see org.eclipse.bpmn2.Bpmn2Package#getFormalExpression_Mixed()
+     * @model unique="false" dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true"
+     *        extendedMetaData="kind='elementWildcard' name=':mixed'"
+     * @generated
+     */
+    FeatureMap getMixed();
+
+    /**
+     * Returns the value of the '<em><b>Body</b></em>' attribute.
      * <!-- begin-user-doc -->
      * <p>
      * If the meaning of the '<em>Body</em>' reference isn't clear,
      * there really should be more of a description here...
      * </p>
      * <!-- end-user-doc -->
-     * @return the value of the '<em>Body</em>' reference.
-     * @see #setBody(Object)
+     * @return the value of the '<em>Body</em>' attribute.
+     * @see #setBody(String)
      * @see org.eclipse.bpmn2.Bpmn2Package#getFormalExpression_Body()
-     * @model required="true" transient="true" derived="true" ordered="false"
+     * @model required="true" volatile="true" derived="true" ordered="false"
      * @generated
      */
-    Object getBody();
+    String getBody();
 
     /**
-     * Sets the value of the '{@link org.eclipse.bpmn2.FormalExpression#getBody <em>Body</em>}' reference.
+     * Sets the value of the '{@link org.eclipse.bpmn2.FormalExpression#getBody <em>Body</em>}' attribute.
      * <!-- begin-user-doc -->
      * <!-- end-user-doc -->
-     * @param value the new value of the '<em>Body</em>' reference.
+     * @param value the new value of the '<em>Body</em>' attribute.
      * @see #getBody()
      * @generated
      */
-    void setBody(Object value);
+    void setBody(String value);
 
     /**
      * Returns the value of the '<em><b>Evaluates To Type Ref</b></em>' reference.
diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/Bpmn2PackageImpl.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/Bpmn2PackageImpl.java
index 024c357..494bcda 100644
--- a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/Bpmn2PackageImpl.java
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/Bpmn2PackageImpl.java
@@ -4694,8 +4694,17 @@
      * <!-- end-user-doc -->
      * @generated
      */
-    public EReference getFormalExpression_Body() {
-        return (EReference) getFormalExpression().getEStructuralFeatures().get(0);
+    public EAttribute getFormalExpression_Mixed() {
+        return (EAttribute) getFormalExpression().getEStructuralFeatures().get(0);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public EAttribute getFormalExpression_Body() {
+        return (EAttribute) getFormalExpression().getEStructuralFeatures().get(1);
     }
 
     /**
@@ -4704,7 +4713,7 @@
      * @generated
      */
     public EReference getFormalExpression_EvaluatesToTypeRef() {
-        return (EReference) getFormalExpression().getEStructuralFeatures().get(1);
+        return (EReference) getFormalExpression().getEStructuralFeatures().get(2);
     }
 
     /**
@@ -4713,7 +4722,7 @@
      * @generated
      */
     public EAttribute getFormalExpression_Language() {
-        return (EAttribute) getFormalExpression().getEStructuralFeatures().get(2);
+        return (EAttribute) getFormalExpression().getEStructuralFeatures().get(3);
     }
 
     /**
diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/FormalExpressionImpl.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/FormalExpressionImpl.java
index 67678a3..22705b1 100644
--- a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/FormalExpressionImpl.java
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/FormalExpressionImpl.java
@@ -18,10 +18,15 @@
 import org.eclipse.bpmn2.FormalExpression;
 import org.eclipse.bpmn2.ItemDefinition;
 import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.BasicFeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
 
 /**
  * <!-- begin-user-doc -->
@@ -30,6 +35,7 @@
  * <p>
  * The following features are implemented:
  * <ul>
+ *   <li>{@link org.eclipse.bpmn2.impl.FormalExpressionImpl#getMixed <em>Mixed</em>}</li>
  *   <li>{@link org.eclipse.bpmn2.impl.FormalExpressionImpl#getBody <em>Body</em>}</li>
  *   <li>{@link org.eclipse.bpmn2.impl.FormalExpressionImpl#getEvaluatesToTypeRef <em>Evaluates To Type Ref</em>}</li>
  *   <li>{@link org.eclipse.bpmn2.impl.FormalExpressionImpl#getLanguage <em>Language</em>}</li>
@@ -40,14 +46,24 @@
  */
 public class FormalExpressionImpl extends ExpressionImpl implements FormalExpression {
     /**
-     * The cached value of the '{@link #getBody() <em>Body</em>}' reference.
+     * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @see #getMixed()
+     * @generated
+     * @ordered
+     */
+    protected FeatureMap mixed;
+
+    /**
+     * The default value of the '{@link #getBody() <em>Body</em>}' attribute.
      * <!-- begin-user-doc -->
      * <!-- end-user-doc -->
      * @see #getBody()
      * @generated
      * @ordered
      */
-    protected EObject body;
+    protected static final String BODY_EDEFAULT = null;
 
     /**
      * The cached value of the '{@link #getEvaluatesToTypeRef() <em>Evaluates To Type Ref</em>}' reference.
@@ -103,39 +119,46 @@
      * <!-- end-user-doc -->
      * @generated
      */
-    public Object getBody() {
-        if (body != null && body.eIsProxy()) {
-            InternalEObject oldBody = (InternalEObject) body;
-            body = eResolveProxy(oldBody);
-            if (body != oldBody) {
-                if (eNotificationRequired())
-                    eNotify(new ENotificationImpl(this, Notification.RESOLVE,
-                            Bpmn2Package.FORMAL_EXPRESSION__BODY, oldBody, body));
-            }
+    public FeatureMap getMixed() {
+        if (mixed == null) {
+            mixed = new BasicFeatureMap(this, Bpmn2Package.FORMAL_EXPRESSION__MIXED);
         }
-        return body;
+        return mixed;
     }
 
     /**
      * <!-- begin-user-doc -->
      * <!-- end-user-doc -->
-     * @generated
+     * @generated NOT
      */
-    public Object basicGetBody() {
-        return body;
+    public String getBody() {
+        if (mixed != null && !mixed.isEmpty()) {
+            StringBuilder result = new StringBuilder();
+            for (FeatureMap.Entry cur : mixed) {
+                switch (cur.getEStructuralFeature().getFeatureID()) {
+                case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__CDATA:
+                case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT__TEXT:
+                    result.append(cur.getValue());
+                    break;
+
+                default:
+                    break;
+                }
+            }
+            return result.toString();
+        }
+
+        return null;
     }
 
     /**
      * <!-- begin-user-doc -->
      * <!-- end-user-doc -->
-     * @generated
+     * @generated NOT
      */
-    public void setBody(Object newBody) {
-        Object oldBody = body;
-        body = (EObject) newBody;
-        if (eNotificationRequired())
-            eNotify(new ENotificationImpl(this, Notification.SET,
-                    Bpmn2Package.FORMAL_EXPRESSION__BODY, oldBody, body));
+    public void setBody(String newBody) {
+        getMixed().clear();
+        getMixed().add(XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text(), newBody);
     }
 
     /**
@@ -208,12 +231,29 @@
      * @generated
      */
     @Override
+    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID,
+            NotificationChain msgs) {
+        switch (featureID) {
+        case Bpmn2Package.FORMAL_EXPRESSION__MIXED:
+            return ((InternalEList<?>) getMixed()).basicRemove(otherEnd, msgs);
+        }
+        return super.eInverseRemove(otherEnd, featureID, msgs);
+    }
+
+    /**
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    @Override
     public Object eGet(int featureID, boolean resolve, boolean coreType) {
         switch (featureID) {
+        case Bpmn2Package.FORMAL_EXPRESSION__MIXED:
+            if (coreType)
+                return getMixed();
+            return ((FeatureMap.Internal) getMixed()).getWrapper();
         case Bpmn2Package.FORMAL_EXPRESSION__BODY:
-            if (resolve)
-                return getBody();
-            return basicGetBody();
+            return getBody();
         case Bpmn2Package.FORMAL_EXPRESSION__EVALUATES_TO_TYPE_REF:
             if (resolve)
                 return getEvaluatesToTypeRef();
@@ -232,8 +272,11 @@
     @Override
     public void eSet(int featureID, Object newValue) {
         switch (featureID) {
+        case Bpmn2Package.FORMAL_EXPRESSION__MIXED:
+            ((FeatureMap.Internal) getMixed()).set(newValue);
+            return;
         case Bpmn2Package.FORMAL_EXPRESSION__BODY:
-            setBody((Object) newValue);
+            setBody((String) newValue);
             return;
         case Bpmn2Package.FORMAL_EXPRESSION__EVALUATES_TO_TYPE_REF:
             setEvaluatesToTypeRef((ItemDefinition) newValue);
@@ -253,8 +296,11 @@
     @Override
     public void eUnset(int featureID) {
         switch (featureID) {
+        case Bpmn2Package.FORMAL_EXPRESSION__MIXED:
+            getMixed().clear();
+            return;
         case Bpmn2Package.FORMAL_EXPRESSION__BODY:
-            setBody((Object) null);
+            setBody(BODY_EDEFAULT);
             return;
         case Bpmn2Package.FORMAL_EXPRESSION__EVALUATES_TO_TYPE_REF:
             setEvaluatesToTypeRef((ItemDefinition) null);
@@ -274,8 +320,10 @@
     @Override
     public boolean eIsSet(int featureID) {
         switch (featureID) {
+        case Bpmn2Package.FORMAL_EXPRESSION__MIXED:
+            return mixed != null && !mixed.isEmpty();
         case Bpmn2Package.FORMAL_EXPRESSION__BODY:
-            return body != null;
+            return BODY_EDEFAULT == null ? getBody() != null : !BODY_EDEFAULT.equals(getBody());
         case Bpmn2Package.FORMAL_EXPRESSION__EVALUATES_TO_TYPE_REF:
             return evaluatesToTypeRef != null;
         case Bpmn2Package.FORMAL_EXPRESSION__LANGUAGE:
@@ -296,7 +344,9 @@
             return super.toString();
 
         StringBuffer result = new StringBuffer(super.toString());
-        result.append(" (language: ");
+        result.append(" (mixed: ");
+        result.append(mixed);
+        result.append(", language: ");
         result.append(language);
         result.append(')');
         return result.toString();
diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/bpmn2.ecore b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/bpmn2.ecore
index 9c62d72..0cc8ccb 100644
--- a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/bpmn2.ecore
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/impl/bpmn2.ecore
@@ -2831,8 +2831,15 @@
       <details key="name" value="tFormalExpression"/>

       <details key="kind" value="mixed"/>

     </eAnnotations>

-    <eStructuralFeatures xsi:type="ecore:EReference" name="body" ordered="false" lowerBound="1"

-        eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject" transient="true"

+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" unique="false" upperBound="-1"

+        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">

+      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">

+        <details key="kind" value="elementWildcard"/>

+        <details key="name" value=":mixed"/>

+      </eAnnotations>

+    </eStructuralFeatures>

+    <eStructuralFeatures xsi:type="ecore:EAttribute" name="body" ordered="false" lowerBound="1"

+        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" volatile="true"

         derived="true"/>

     <eStructuralFeatures xsi:type="ecore:EReference" name="evaluatesToTypeRef" ordered="false"

         lowerBound="1" eType="#//ItemDefinition">

diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2ResourceImpl.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2ResourceImpl.java
index 42db1ff..d9dcd2c 100644
--- a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2ResourceImpl.java
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2ResourceImpl.java
@@ -100,6 +100,8 @@
             protected boolean shouldSaveFeature(EObject o, EStructuralFeature f) {

                 if (Bpmn2Package.eINSTANCE.getDocumentation_Text().equals(f))

                     return false;

+                if (Bpmn2Package.eINSTANCE.getFormalExpression_Body().equals(f))

+                    return false;

                 return super.shouldSaveFeature(o, f);

             }

         };

diff --git a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceImpl.java b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceImpl.java
index ffcd77f..ba72bff 100644
--- a/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceImpl.java
+++ b/org.eclipse.bpmn2/src/org/eclipse/bpmn2/util/Bpmn2XMIResourceImpl.java
@@ -63,6 +63,8 @@
             protected boolean shouldSaveFeature(EObject o, EStructuralFeature f) {
                 if (Bpmn2Package.eINSTANCE.getDocumentation_Mixed().equals(f))
                     return false;
+                if (Bpmn2Package.eINSTANCE.getFormalExpression_Mixed().equals(f))
+                    return false;
                 return super.shouldSaveFeature(o, f);
             }
         };