Type "Element" in moddle

I was looking at bpmn-moddle to find where the type Element is defined since it is used, for example, in the values of the extension elements, and I had to extend it in my BPMN extension (token-bpmn-moddle) to put my elements into the extension elements.

I saw that in the BPMN specification, the values of extension elements have the type xsd:any (p62). Is the type Element that exists by default moddle’s way to implement any ?

Thanks in advance for the clarification. I consider extending the moddle documentation with a pull-request if I understand this correctly.

Hi Tim,

I am not quite understanding what you are trying to do. Can you explain your use-case a bit and what you tried to do so far?

In general, you do not need to subclass anything from moddle to add it to the extension elements. E.g., this is valid in bpmn XML:

<bpmn:extensionElements>
  <my:property xmlns:my="http://example.com" />
</bpmn:extensionElements>

If you have added your moddle extension to the viewer instance, you’ll also have access to the defined properties and attributes in the extension element list.

Hi Martin,

My use case works fine. I am just wondering where the type Element is defined in moddle. It seems to be in any moddle .json file without being explicitly defined.

It seems necessary to implement extension elements even though, as you said, any XML is valid inside the extension elements. For example, in camunda-bpmn-moddle, it is also used for defining possible extension elements. See the example for the Execution listener below:

Moddle specification:

"name": "ExecutionListener",
"superClass": [ "Element" ],

XML-example:

<bpmn:receiveTask id="Activity_0oaphql">
    <bpmn:extensionElements>
      <camunda:executionListener class="" event="start" />
    </bpmn:extensionElements>
    <bpmn:incoming>Flow_0qt4mpu</bpmn:incoming>
</bpmn:receiveTask>

I was just wondering if this is documented somewhere or could be better documented in the future.

I just found the documentation I desired.

Here bpmn.io states in the README.md:

If you want to add extension elements to bpmn:ExtensionElements they have to have "superClass": [ "Element" ].

But maybe the type “Element” could be better explained in the moddle documentation since it seems to be special.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.