Update bpmn file programmatically

Hi everyone,
I want to add some tasks (or other elements), in special points of a bpmn file (which is generated by Camunda modeler) using a java code. In other words, I don’t want to use a modeler for this purpose. Is there any package for this purpose in Camunda?
I just found something named “BPMNParser”, for parsing a BPMN file, not updating it. I am already parsing the BPMN file using “DocumentBuilder” in java and locating the point, in which I want to insert a new element, using an XPath expression. Then I can add a new bpmn element in “bpmn:process”, but adding it to the “bpmndi:BPMNDiagram” would be even more challenging.

I do really appreciate any ideas or possible packages in this regard.

Hi,
I think Camunda’s BPMN Model API can be the thing you’re looking for:

It has everything you need to parse, alter, and write BPMN files programmatically.
Also, have a look at the documentation:

3 Likes

Thanks a lot @StephanHaarmann. That is exactly what I was looking for. I wonder how I haven’t seen it in my searches.