Creating XML for bpmn.io application

Hi, i’m developing a tool and I trying to generate the XML file for the bpmn.io application for diagram a subprocess. Dont know why its not showing the task inside the subprocess.

Here is the output.

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC">
  <bpmn:process id="Process_1" isExecutable="false">
  <bpmn:startEvent id="StartEvent_1" />
<bpmn:subProcess id="Testing_SubProcess">
  <bpmn:task id="Task_1111" name="Task_1111" />
</bpmn:subProcess>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
  <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
    <dc:Bounds x="173" y="102" width="36" height="36" />
  </bpmndi:BPMNShape>
  <bpmndi:BPMNShape id="Testing_SubProcess_di" bpmnElement="Testing_SubProcess">
    <dc:Bounds x="276" y="71" width="350" height="200" />
  </bpmndi:BPMNShape>
  <bpmndi:BPMNShape id="Task_1111_di" bpmnElement="Task_1111">
    <dc:Bounds x="303" y="117" width="100" height="80" />
  </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

Hope that can anybody help me. Thanks in advance.

Hi @guiles,

in your XML you defined a collapsed sub process. If you want the child elements to be visible, the sub process needs to be expanded. Just set the isExpanded property:

<bpmndi:BPMNShape id="Testing_SubProcess_di" bpmnElement="Testing_SubProcess" isExpanded="true">
  ...
</bpmndi:BPMNShape>

Thanks @pedesen, it was just that attribute… :smile:

@guiles Hi, im currently working on the same thing of generate the xml file for bpmn. Can you share something with how to generate the <bpmndi:BPMNDiagram …> part by coding? Thank you so much!

Hi @kaiyingzhang

Firstly, please do not necrobump old topics, instead, open a new thread with your new question.

Regarding your question: we do not offer a solution for generating the DI part of a diagram directly. We have a no-longer-maintained solution for that: https://github.com/bpmn-io/bpmn-moddle-auto-layout, but it’s not stable.