XML (vs HTML)
- VALIDATED AGAINST XML SCHEMA (XSD)
Each element is attached to more or less wellknown (moddle/moddle-xml speak) namespace
Namespaces in BPMN (common) => We have our own schema for them (moddle descriptors)
- BPMN
- BPMNDI
- DI
- DC
BPMN20.xsd => BPMN Schema.
Prefixes are cosmetic but on the other hand => We try to keep them on roundtrip (but clean unused)
<bpmn:definitions xmlns:bpmn="http://bpmn" xmlns:camunda="http://camunda"> bpmn:extensionElements camunda:foo</camunda:foo> </bpmn:extensionElements>
camunda:foo</camunda:foo>
<bpmn:bar camunda:foo="ASDSAD"></bpmn:bar> </bpmn:definitions>
// represented at runtime in moddle tree definitions => { $attrs: { 'xmlns:bpmn': 'http://bpmn' } }
==> exports to this
<bpmn:definitions xmlns:bpmn="http://bpmn"> bpmn:bar</bpmn:bar> </bpmn:definitions>
(definitions => http://bpmn) (bar => http://bpmn)
foo:bar</foo:bar>
(definitions => http://bpmn) (bar => http://bpmndi)
(definitions => http://bpmn) (BPMNDiagram => http://bpmndi)
==> Structural XML compliantness ==> Schema XML compliantness
bpmn-js IMPORT flow
==> saxen parses XML structrure ==> moddle-xml validates XML Schema compliennes => semantics ==> BPMN-jS => bpmn-moddle provides SChema definitions
===> Object tree of XML document that is easier to work with
bpmn-js EXPORT flow
==> moddle-xml uses tree (and attached schema) to write compliant XML
BEST CASE SCENARIO (and our goal for roundtrip)
- we can import any BPMN 2.0 XML schema compliant elenetn
- every diagram we export is complete and BPMN 2.0 XML schema compliant