Skip to content

Instantly share code, notes, and snippets.

@nikku
Created April 28, 2020 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikku/e58aa20a06d88a52358e79cac92c4c60 to your computer and use it in GitHub Desktop.
Save nikku/e58aa20a06d88a52358e79cac92c4c60 to your computer and use it in GitHub Desktop.
XML lightning talk brain dump

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment