Please provide XMI and SCXML export for state diagrams

+1 vote
asked Mar 26, 2016 in Closed feature request by milena.dyle (140 points)
Please provide XMI and SCXML export for state diagrams.

1 Answer

+1 vote
answered Mar 29, 2016 by plantuml (257,860 points)
selected Mar 30, 2016 by milena.dyle
 
Best answer

In last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
We have added the -tscxml flag which allow the export to SCXML format for state diagram. It only works for state diagrams. We also added XMI export for state diagrams.

Some stuff may not be working, so do not hesitate to post messages here!


For XMI export: (see http://plantuml.com/xmi.html )


Would this fit your needs ?

commented Mar 30, 2016 by milena.dyle (140 points)
Thank you very much!
commented Mar 26, 2020 by hoff (100 points)

Hi, we would like to standardize on SCXML for code generation, however I am seeing an issue where nested states are not present in the exported SCXML.

For example:

@startuml

state A1 {
    B1 -> B2
    B2 -> B1
}
A1 -> A2
A2 -> A1

@enduml

Gives: 

<?xml version="1.0" encoding="UTF-8"?><scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0">
    <state id="B1">
        <transition target="B2"/>
    </state>
    <state id="B2">
        <transition target="B1"/>
    </state>
    <state id="A2">
        <transition target="A1"/>
    </state>
</scxml>

State A1 is missing as well as its transition to A2.

One clue is that even putting empty curly braces causes the states to be ignored in the XML output:

@startuml

state A1 {
}
state A2 {
}

A1 -> A2
A2 -> A1

@enduml

 Gives a mostly empty output:

<?xml version="1.0" encoding="UTF-8"?><scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"/>

Any help on this would be greatly appreciated! 

commented Jan 26 by Martin

Hi!

One finding from my side is the following:


When a model the traffic light with "->" arrows, everything works fine.

Input:

@startuml

state Red
state Yellow1
state Yellow2
state Green

[*] -> Red
Red -> Yellow1
Yellow1 -> Green
Green -> Yellow2
Yellow2 -> Red

@enduml

Output:

<state id="Red">
<transition target="Yellow1"/>
</state>
<state id="Yellow1">
<transition target="Green"/>
</state>
<state id="Yellow2">
<transition target="Red"/>
</state>
<state id="Green">
<transition target="Yellow2"/>
</state>
<state id="start">
<transition target="Red"/>
</state>
</scxml>


But modelling with direction indicators "-down->" gives a wrong output

Input:

@startuml

state Red
state Yellow1
state Yellow2
state Green

[*] -> Red
Red -down-> Yellow1
Yellow1 -down-> Green
Green -up-> Yellow2
Yellow2 -up-> Red

@enduml

Output:

<state id="Red">
<transition target="Yellow1"/>
<transition target="Yellow2"/>
</state>
<state id="Yellow1">
<transition target="Green"/>
</state>
<state id="Yellow2">
<transition target="Green"/>
</state>
<state id="Green"/>
<state id="start">
<transition target="Red"/>
</state>
</scxml>

commented Jan 26 by Martin
For the same example of traffic lights, I tried XMI export. But this one has another weakness: It does not contain a from-to-information about transitions. We know between which states the transition is but we miss an direction indicator:

<UML:Association namespace="model1" xmi.id="ass18">
    <UML:Association.connection>
        <UML:AssociationEnd association="ass18" type="cl0002" xmi.id="end19">
        <UML:AssociationEnd.participant/>
        </UML:AssociationEnd>
        <UML:AssociationEnd association="ass18" type="cl0004" xmi.id="end20">
        <UML:AssociationEnd.participant/>
        </UML:AssociationEnd>
    </UML:Association.connection>
</UML:Association>
commented 4 days ago by Jon
Any update on being able to export nested/compound states correctly to scxml?  I am facing a similar issue.
...