commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <rahul.akol...@gmail.com>
Subject Re: [SCXML] Reusing statediagrams through the src attribute in state
Date Mon, 21 Jul 2008 15:28:41 GMT
On Mon, Jul 21, 2008 at 9:59 AM, Berg, T.W. (Tom) van den
<tom.vandenberg@tno.nl> wrote:
> I would like to reuse a statediagram in an overall state diagram. The
> src attribute in the state tag seems to suggest this is possible.
> For example the main state.xml file would contain:
>
> ----
>
>  <state id="Composite1" src="include.xml">
>  <state id="finalState">
>   <transition target="Composite2"/>
>  </state>
>  </state>
>
>  <state id="Composite2" src="include.xml">
>  <state id="finalState">
>   <transition target="Composite3"/>
>  </state>
>  </state>
>
>  <state id="Composite3" src="include.xml">
>  <state id="finalState">
>  </state>
>  </state>
>
> ----
>
> And the (simplified) include.xml looks like:
>
> <scxml xmlns="http://www.w3.org/2005/07/scxml
> <http://www.w3.org/2005/07/scxml> "
>       xmlns:rti="http://rti.actions/CUSTOM <http://rti.actions/CUSTOM>
> "
>       version="1.0"
>       initialstate="sp">
>
>  <state id="sp">
>  <transition target="finalState"/>
>  </state>
> </scxml>
>
>
> ----
>
> However, this example does not work.
>
> I get the following error:
> 21-jul-2008 15:50:24 org.apache.commons.scxml.io.ModelUpdater
> logAndThrowModelError
> SEVERE: Initial state null or not a descendant of state with ID
> "Composite1"
>
<snip/>

There are (atleast) three states in the above document with the same
ID ("finalState"), which violates the uniqueness constraint.


> Does nesting and state reuse work this way?
<snap/>

Yes, when done right. Some notes contributed by users to the wiki on
this topic may also be helpful:

  http://wiki.apache.org/commons/SCXML/Tutorials/Templating


> What are alternate ways to reuse state diagrams?
>
<snip/>

I know folks have suggested using XML entities, but that doesn't
necessarily address "importing" such fragments multiple times into the
same SCXML state machine definition.

-Rahul


>
> -- Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message