Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

including states defined in external xml files #192

Open
crichardson332 opened this issue Jan 31, 2020 · 1 comment
Open

including states defined in external xml files #192

crichardson332 opened this issue Jan 31, 2020 · 1 comment

Comments

@crichardson332
Copy link

We have a state machine up and running using uscxml as our interpreter, and it's working great. But now we would like to define a state machine across multiple files - namely, having a core scxml file that stays relatively constant for different scenarios, which then includes states and transitions defined in other xml files for mission specific things that change frequently.

Does uscxml support the xmlns:xi functionality of scxml? I've tried examples from the main scxml documentation with no luck, and I tried examples from this paper here on page 101. I tried defining ENTITY objects to pull in external xml files and that resulted in errors, and when I tried including a state via a line like this

<xi:include href="bathroom.scxml" />

the parser seems to just ignore the line and continue as if it doesn't exist. Even if the included file doesn't exist, the parser just skips over it and continues with no error

Does uscxml support any method of pulling in states defined elsewhere? Thanks!

@alexzhornyak
Copy link
Contributor

XInclude

Method Interpreter Interpreter::fromXML does not support xinclude.
But you may load resulting SCXML by yourself and then call Interpreter::fromElement or Interpreter::fromDocument.

Also you may use visual chart splitting. In this case you will have resulting common scxml but parts may be editted separately.

Pros:

  • Common datamodel (easy data sharing)
  • You may use 'In' predicate

Cons:

  • Difficult control of identifier uniqueness (state names, event identifiers etc.)
  • Not all parsers (SDKs) supports XInlcude

<invoke>

You may use <invoke> with content src as alternative.

Pros:

  • You may use multiple same invoke instances with passing individual params
  • Instance is isolated (you do not worry about same identifiers)

Cons:

  • Can not have common resources (every time copying data between sessions)
  • Can not use 'In' predicate for other instances

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants