BPMN model file created by doWriteModelToFile API doesn't render well over Camunda Modeler

Hi Team,

Referring to this blog: https://blog.camunda.com/post/2014/02/the-new-camunda-bpmn-model-api/ , I was using bpmn-model-apis to create a process model and used writeModelToFile to write a bpmn model file.

  Bpmn.writeModelToFile(new File("target/new-process.bpmn"), modelInstance);

The file hence created new-procee.bpmn doesn’t render the picture in the camunda modeler.
image
I am not sure if this is normal. My guess is, there is something wrong with the model’s XML.

    failed to import content for file "bpmn-model-api2726815567980105991.bpmn"  [error]
    `no diagram to display  [error]`



failed to import content for file "bpmn-model-api2726815567980105991.bpmn"  [error]
bo.get is not a function  [error]

Ideally, the models carry XML tags that start with bpmn:, but this model’s XML lacks this. The blog link also suggests the same.

How do I view the model created through doWriteModelToFile API?
Thanks,
susenj

Hi Susenj,

If you want to import the model in the Modeler, please use Bpmn.convertToString().
For more information please check this page.

Best regards,
Yana

Thanks Yana. We managed to do that.

1 Like