Contents | Overview | Examples | Editor | Forum |
---|
Holds the representation of a state.
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="StateAtomic"/>
</scxml>
The identifier for this state.
The id of the default initial state (or states) for this state.
Example: 'State1' is specified as initial
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="Work" initial="State1">
<state id="State1">
<onentry>
<log expr="Hello!" label="State 1"/>
</onentry>
<transition event="Step" target="State2"/>
</state>
<state id="State2">
<onentry>
<log expr="Hello!" label="State 2"/>
</onentry>
<transition event="Step" target="State3"/>
</state>
<state id="State3">
<onentry>
<log expr="Hello!" label="State 3"/>
</onentry>
<transition event="Step" target="State1"/>
</state>
</state>
</scxml>
Output:
[Log] State 1: "Hello!"
Example: 'State3' is specified as initial
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="Work" initial="State3">
<state id="State1">
<onentry>
<log expr="Hello!" label="State 1"/>
</onentry>
<transition event="Step" target="State2"/>
</state>
<state id="State2">
<onentry>
<log expr="Hello!" label="State 2"/>
</onentry>
<transition event="Step" target="State3"/>
</state>
<state id="State3">
<onentry>
<log expr="Hello!" label="State 3"/>
</onentry>
<transition event="Step" target="State1"/>
</state>
</state>
</scxml>
1. MUST NOT be specified in conjunction with the <initial> element.
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="Work" initial="State1">
<state id="State1">
<onentry>
<log expr="Hello!" label="State 1"/>
</onentry>
<transition event="Step" target="State2"/>
</state>
<state id="State2">
<onentry>
<log expr="Hello!" label="State 2"/>
</onentry>
</state>
<initial>
<transition target="State1"/>
</initial>
</state>
</scxml>
Output:
Issue (WARNING) at //state[@id="Work"]: State with initial attribute cannot have <initial> child
2. MUST NOT occur in atomic states.
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="StateAtomic" initial="StateXXX"/>
</scxml>
Output:
Issue (FATAL) at //state[@id="StateAtomic"]: Initial attribute has invalid target state with id 'StateXXX'
Has no <state>, <parallel> or <final> children.
Has <state>, <parallel>, or <final> children (or a combination of these).
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="StateCompaund">
<state id="StateAtomic"/>
</state>
</scxml>
Specified by the 'initial' attribute or <initial> element, if either is present. Otherwise it is the state's first child state in document order.
Example 1
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="Work" initial="State2">
<state id="State1">
<transition event="Step" target="State2"/>
</state>
<state id="State2">
<onentry>
<log expr="I am initial!" label="State 1"/>
</onentry>
<transition event="Step" target="State1"/>
</state>
</state>
</scxml>
Example 2
<scxml name="Scxml" version="1.0" xmlns="http://www.w3.org/2005/07/scxml">
<state id="Work">
<state id="State1">
<onentry>
<log expr="I am initial!" label="State 1"/>
</onentry>
<transition event="Step" target="State2"/>
</state>
<state id="State2">
<transition event="Step" target="State1"/>
</state>
</state>
</scxml>
Definition: The default initial state(s) of a compound state are those specified by the 'initial' attribute or initial element, if either is present. Otherwise it is the state's first child state in document order. If a compound state is entered either as an initial state or as the target of a transition (i.e. and no descendent of it is specified), then the SCXML Processor MUST enter the default initial state(s) after it enters the parent state.
TOP | Contents | Overview | Examples | Editor | Forum |
---|