Elements inside DataAssociation are not written to XML in the right order


#1

Elements inside DataAssociation are not written to XML in the order specified in BPMN 2.0 schema:

<xsd:sequence> <xsd:element name="sourceRef" type="xsd:IDREF" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="targetRef" type="xsd:IDREF" minOccurs="1" maxOccurs="1"/> <xsd:element name="transformation" type="tFormalExpression" minOccurs="0" maxOccurs="1"/> <xsd:element ref="assignment" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence>

In bpmn.io “assignment” in inserted in the first place because of this definition:
...{ "name": "DataAssociation", "superClass": [ "BaseElement" ], "properties": [ { "name": "assignment", "type": "Assignment", "isMany": true }, { "name": "sourceRef", "type": "ItemAwareElement", "isMany": true, "isReference": true }, { "name": "targetRef", "type": "ItemAwareElement", "isReference": true }, { "name": "transformation", "type": "FormalExpression", "xml": { "serialize": "property" } } ] }...


#2

Hey @ThePasko,

has this caused any problem with exporting BPMN diagrams ?

Cheers,
Ricardo


#3

@ThePasko Could you provide us with an example diagram that allows us to reproduce this issue and provide a fix for it?


#4

As of version 0.18.4 this is still seems to be an issue.
Sorry I can’t provide an example because our example contains sensitive data.
But the fix is to simple correct the attribute order in the definition like so:

{
  "name": "DataAssociation",
  "superClass": [
    "BaseElement"
  ],
  "properties": [        
    {
      "name": "sourceRef",
      "type": "ItemAwareElement",
      "isMany": true,
      "isReference": true
    },
    {
      "name": "targetRef",
      "type": "ItemAwareElement",
      "isReference": true
    },		
    {
      "name": "transformation",
      "type": "FormalExpression",
      "xml": {
        "serialize": "property"
      }
    },
    {
      "name": "assignment",
      "type": "Assignment",
      "isMany": true
    }
  ]
}

#5

Unfortunately we won’t be able to fix anything without an example that shows the stuff is broken.