Add text element to bpmn:extensionElements

Hi, i’m developing a tool which export some data to import to bpmn.io.

To do that i have to save some extra data ( in order to import back to my tool ). I think that bpmn:extensionElements is the element to do that.

I have these xml:

   <bpmn:task id="Task_1" name="Init _1">
      <bpmn:extensionElements id="id" />   
        some json data    
     </bpmn:extensionElements>
    </bpmn:task> 

But when importing to bpmn.io the xml just take these.

<bpmn:extensionElements id="id" />

Is there a way to append a TextNode element or an element to append to extensionElement so i can save the text data.

Thank you in advance.
Regards,
G.

You need to wrap the JSON into a custom tag inside the <bpmn:extensionElements />. That is how the BPMN spec allows extending the document schema.

The XML could look something like this:

   <bpmn:task id="Task_1" name="Init _1">
     <bpmn:extensionElements id="id" />
       <foo:jsonPayload xmlns:foo="http://foo">
         some json data
       </foo:jsonPayload>
     </bpmn:extensionElements>
   </bpmn:task>

Thanks, it works!

Regards!