Skip to content

BPMN XML Import & Export

yh-flow exposes a BPMN 2.0 XML bridge so you can export Flow canvas content for BPMN engines or import existing BPMN diagrams back into Flow for preview and validation.

When to Use

  • When you need to deliver Flow diagrams to BPMN tooling such as Camunda, Flowable, or bpmn.io
  • When you want to inspect or visualize BPMN XML created elsewhere inside Flow
  • When you want to verify and sanitize XML before handing it to another system

Core APIs

APIDescription
flowToBpmnXml(nodes, edges, options)Converts nodes and edges into BPMN 2.0 XML; includeDi controls whether graphical coordinates are emitted
bpmnXmlToFlow(xml, options)Parses BPMN XML and returns Flow-friendly nodes/edges with optional fallback layout
validateBpmnXml(xml)Ensures the XML contains the required <definitions> and <process> sections
generateSampleBpmnXml()Returns a built-in sample process that can be imported or featured in demos

Example

The demo below exports BPMN XML from the canvas, loads the built-in sample XML, and validates the serialized result.

Ready for export. Press a button to see the XML
BPMN XML Import Sample

Best Practices

  1. Keep definitions in sync: Always call flowToBpmnXml before exporting so the XML reflects the latest canvas state.
  2. Validate before import: Run validateBpmnXml before feeding XML into another system to catch structural issues early.
  3. Control DI output: Use the includeDi option to decide whether the export contains layout information.
  4. Leverage the sample: generateSampleBpmnXml is great for smoke tests, onboarding demos, or generating mock data.

Released under the MIT License.