
This document describes how the JavaScript converter transforms SCXML into the scjson format. It captures the inference logic encoded in js/src/converters.js so that other language implementations can reproduce identical behaviour.
<scxml>."tag" field holding the tag name.tag.The converter lifts specific child elements out of content[] so that they live directly on the parent object. Each of the following tags becomes an array property on its parent:
stateparallelfinalhistorytransitiononentryonexitinvokedatamodeldatainitialscriptlogassignsendcancelWhen any of these elements are present:
state: []).content[] unless its tag is unknown.content[].{ "tag": "..." } with no additional fields.<state id="parent">
<transition event="go" target="child"/>
<state id="child"/>
<onentry>
<log label="start" expr="enter"/>
<foo/>
</onentry>
</state>
{
"tag": "state",
"id": "parent",
"transition": [{
"tag": "transition",
"event": "go",
"target": ["child"]
}],
"state": [{ "tag": "state", "id": "child" }],
"onentry": [{
"tag": "onentry",
"log": [{ "tag": "log", "label": "start", "expr": "enter" }],
"content": [{ "tag": "foo" }]
}]
}
The unknown <foo/> element remains inside content[] of the onentry block.
element.tagName, element.attributes, and element.children when walking the DOM.STRUCTURAL_FIELDS is a Set controlling whether a child is lifted out of content[].