# Convert to xml diagram

**URL:** <https://forum.flowable.org/t/convert-to-xml-diagram/98>\
**Category:** Uncategorized\
**Created:** [November 15, 2016, 7:12am UTC](https://forum.flowable.org/t/convert-to-xml-diagram/98 "2016-11-15T07:12:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nihar](https://avatars.discourse-cdn.com/v4/letter/n/da6949/32.png) [@nihar](https://forum.flowable.org/u/nihar)\
**Post date:** [November 15, 2016, 7:12am UTC](https://forum.flowable.org/t/convert-to-xml-diagram/98/1 "2016-11-15T07:12:44Z")

</div>

I want to generate the attached xml diagram through java code.Please share the code snippet  
 ![](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/flowable/original/1X/c1952e09b9756e02912e1a9576ee4f4f2f027b56.png)

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [November 15, 2016, 3:55pm UTC](https://forum.flowable.org/t/convert-to-xml-diagram/98/2 "2016-11-15T15:55:27Z")

</div>

Hi Nihar,

check `org.activiti.rest.service.api.runtime.process.ProcessInstanceDiagramResource#getProcessInstanceDiagram` reast end point. There is exact way how to get image from process instance id. (it is similar for your case.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![nihar](https://avatars.discourse-cdn.com/v4/letter/n/da6949/32.png) [@nihar](https://forum.flowable.org/u/nihar)\
**Post date:** [November 16, 2016, 5:40am UTC](https://forum.flowable.org/t/convert-to-xml-diagram/98/3 "2016-11-16T05:40:30Z")

</div>

the diagram is not generated for the same API…  
I want to create bpmnModel to generate the xml(attached).  
Please share java code to create bpmnModel to create activities and pass the same bpmnModel to the method convertToXML(bpmnModel)

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [November 16, 2016, 6:58am UTC](https://forum.flowable.org/t/convert-to-xml-diagram/98/4 "2016-11-16T06:58:01Z")

</div>

Hi Nihar,

Now I understand your question little bit more (I am still not sure).  
Somebody else has to answer your question.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![tijs](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tijs](https://forum.flowable.org/u/tijs)\
**Post date:** [November 21, 2016, 6:08pm UTC](https://forum.flowable.org/t/convert-to-xml-diagram/98/5 "2016-11-21T18:08:11Z")

</div>

Hi Nihar,

There’s the flowable-bpmn-layout module, that will try to create a good layout for a provided BpmnModel without graphical interchange information:

BpmnAutoLayout bpmnLayout = new BpmnAutoLayout(bpmnModel);  
bpmnLayout.execute();

This is always a best effort action. To get good BPMN DI or graphical interchange information you need the web modeler or the Eclipse Designer and model the process definition in a graphical way.

Best regards,

Tijs
