Not able to download the custom Modeler diagram

Hi guys,

I’m trying to test the customModeler. What I’d like to do is to export the custom Modeler diagram to xml file. So I added the download button to this project like the below image. https://github.com/bpmn-io/bpmn-js-example-custom-shapes.

.
The problem is when I download I’m getting the following issue.
image
. Below is the code that I export to xml.

async function downloadXML() {
  try {

    const { xml } = await modeler.saveXML({ format: true });
    const blob = new Blob([xml], { type: 'data:application/bpmn20-xml;charset=UTF-8' });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = 'diagramzzzz.bpmn';
    a.click();
    URL.revokeObjectURL(url);


  } catch (err) {
    console.error('Error happened saving XML: ', err);  
  }

}

Have you done any further customizations to that example?

Hello Philipp…I didn’t do any customization on that example. I just added a new button and put the code snippet which is downloadXML().

Hello,

Custom shapes from this example are not meant to be serialized out of the box, as it says on the top of the readme file. Instead you should look at building custom BPMN elements.

You can try to customize the serialization to skip custom elements and save them to a JSON file along with the XML file.

I got it. Thank you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.