Generate BPMN diagram on importing file without <bpmndi:BPMNDiagram> part

Hi everyone,

I am currently working on my own BPMN modeler, but I was getting a problem when importing an existing BPMN file without the bpmndi:BPMNDiagram part.

For example my input would be something like:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="" xmlns:bpmndi="" xmlns:dc="" xmlns:di="" >
  <process id="Process_1" isExecutable="false">
    <startEvent id="StartEvent_1" />
    <endEvent id="EndEvent_191tx7z" />

But since the xml does not contain the bpmndi:BPMNDiagram part, my modeler could not render the file.

Is there any other API I could look into to solve my problem? Like auto generating a set of coordinates.

By the way, I can use bpmn-moddle to parse the xml to a Moddle tree, so the problem would also be converting a moddle tree to a renderable full xml.


There is an example implementation for that:
You could use this as a starting point.

Works like a charm, thanks!

1 Like