Create Model: Add CDATA to custom extension elements

We have custom extension elements in our model where we store our metadata. For example, a task can contain a property of exception script in its extension element.

An example of such BPMN XML is attached.

Notify.bpmn (3.8 KB)


We also have a requirement of creating BPMN Model programmatically and we are doing it as per the below link:

However, when we convert the modelInstance to an XML string, the value in the extension element is not added in CDATA. Is there a way to add the extension element information in the CDATA section?

Attached is the BPMN XML that is generated programmatically. If you see here, there is a property tag inside the extension elements whose value is NOT present in the CDATA section because of which it fails while loading.

Notify_Programmatically.bpmn (3.7 KB)


The custom property element is added as per the following link:

Here is the code for PDPropertyImpl for reference:

public class PDPropertyImpl extends BpmnModelElementInstanceImpl implements PDProperty {

protected static Attribute<String> nameAttribute;

public static void registerType(ModelBuilder modelBuilder) {
	// removed code for brevity

public PDPropertyImpl(ModelTypeInstanceContext instanceContext) {

public String getName() {
	return (String) nameAttribute.getValue(this);

public void setName(String camundaName) {
	nameAttribute.setValue(this, camundaName);

public String getValue() {
	return this.getTextContent();

public void setValue(String value) {


I guess the problem might be caused by the Model API, right? Iā€™m really not sure whether it depends on our toolkit libraries.

Furthermore, seems to be a duplicate with your post inside the Camunda Forum.

Yes, I posted this question on Camunda forum later on realizing that it is related to Camunda Modeler API.

Can you please advise on what shall be done to the post here - close it?ā€™

Thanks for your time and help!

1 Like

I guess only admins have the rights to close topics. Did it accordingly.