I am creating different SCXML files which are then used by a Qt application. In order to better structure my state machine, I would like to separate the common part of one machine from the custom state of every other machine. So I thought to split my state machine over 2 files.
Parent file: parentStateMachine.scxml
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml"
version="1.0"
binding="early"
xmlns:qt="http://www.qt.io/2015/02/scxml-ext"
name="MyStatemachine.scxml"
qt:editorversion="4.2.2"
datamodel="ecmascript"
initial="s1"
xmlns:xi="http://www.w3.org/2001/XInclude">
<state id="init">
<transition type="external" event="prepare" target="configure"/>
</state>
<state id="configure">
<transition type="external" event="start" target="run"/>
</state>
<parallel id="run">
<!-- include here application specific states-->
<transition type="external" event="stop" target="end"/>
</parallel>
<final id="end">
</final>
</scxml>
application specific: applicationSpecific1.scxml
<state id="applicationSpecificState1"/>
<state id="applicationSpecificState2"/>
<state id="applicationSpecificState3"/>
I have tried including the application specific within the parent one in 2 ways:
I tried inserting
<xi:include href="applicationSpecific1.xml"parse="text"/>
instead of the comment.I tried adding
<!DOCTYPE scxml [<!ENTITY innerFile SYSTEM "applicationSpecific1.scxml">]>
right after thexml
tag and then adding&innerFile;
instead of the comment.
When I load the documents they are parsed fine but from the behavior I would deduce that it does not take into account whatever is defined in the application specific scxml.
PS: I have found this old unresolved bug report which I hope is already resolved. https://bugreports.qt.io/browse/QTBUG-1088