Search code examples
node.jsxmlexpressbpmnbpmn.io

bpmn js - export svg to bpmn xml


I have tried multiple ways to export the svg from the modeler to a bpmn xml, but unable to export. I tried following ways

  1. modeler.moddle.toXML(modeler.get('canvas'), { format: true }, function (err, updatedXML) { console.log(updatedXML); });

  2. modeler.saveXML({ format:true },function(err,output){ if(err){ console.log(err); } else{ console.log(output); } });

  3. cli.save('bpmn'); - It works on the browser console.

I always get these: undefined or no definitions loaded.

Please help.


Solution

  • Well,

    The main problem was my thinking. As I come from a background of PHP type languages that are synchronous; so even though I read about the mean stacks asynchronous nature, I wasn't applying it.

    Later I applied the same code and it worked.