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
| API | Description |
|---|---|
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
- Keep definitions in sync: Always call
flowToBpmnXmlbefore exporting so the XML reflects the latest canvas state. - Validate before import: Run
validateBpmnXmlbefore feeding XML into another system to catch structural issues early. - Control DI output: Use the
includeDioption to decide whether the export contains layout information. - Leverage the sample:
generateSampleBpmnXmlis great for smoke tests, onboarding demos, or generating mock data.