On 2/8/07, Wait, David L             HS <[EMAIL PROTECTED]> wrote:
Hello,

I am unclear if the SCXML engine has problems with correct syntax for
the <assign> tag or if I am misreading the W3C xsd for the <assign> tag.
The W3C xsd specifies that the attributes of <assign> are "location",
"src", and "expr".  I notice that the examples in both the W3C site and
SCXML Commons site use the attribute "name" instead of "location", which
seems to be an error.  For example, the microwave-02.xml example on the
SCXML Commons site contains the following statement that apparently uses
incorrect syntax:

   <assign name="timer" expr="timer + 1"/>

<snip/>

Thumb rule is:

a) Use "name" if you want to point to a scratch space variable
(usually created by <var>, see July 05 draft) -- could be any type
determined by the result of evaluating the "expr".

b) Use "location" for DOM style operations. The location attribute
must evaluate to a org.w3c.dom.Node within a <data> element belonging
to a visible <datamodel>. This is commonly done using the Data()
functions defined by Commons SCXML, see this section of the user guide
[1].


(Note also that the original examples on the W3C site all use the same
apparently incorrect syntax).
<snap/>

Yup, that syntax existed in the first public draft (July '05) but was
removed in favor of a more accomdating schema for "executable"
elements (<onentry>, <onexit>, <transition>). We're now able to define
"custom actions" in arbitrary XML namespaces (see this section of the
user guide [2]).

However, Commons SCXML will support both syntaxes atleast till version
1.0 for backwards compatibility across minor releases.

If you want to point out the discrepancy in the W3C WD, as I mentioned
in another thread a few minutes ago, you can email the WG list (its in
the "Status of this Document" section of the draft and you may want to
subscribe first).


 When I run on the SCXML Commons
StandaloneJexlExpressions class using syntax following the W3C xsd, such
as

   <assign location="timer" expr="timer + 1"/>,

the following message is printed to the console:

Feb 8, 2007 11:00:50 AM org.apache.commons.scxml.env.SimpleErrorReporter
onError
WARNING: EXPRESSION_ERROR (java.lang.ClassCastException:
java.lang.Integer):

<snip/>

It expected a Node, as mentioned above. The error message could indeed
be better. If you want, you can open a JIRA issue [3] towards a better
error message here.


When I change the statement to the apparently wrong syntax <assign
name="timer" expr="timer+1"/> the state machine runs without error
messages.

Please clarify the correct attribute for the <assig> tag.  Be aware that
an scxml editing tool built using the Eclipse Modeling Framework and the
W3C xsd file generates scxml that produces the error message noted
earlier.  My first impression is that the scxml editor built using the
EMF produces the correct syntax for the <assign> tag.

<snip/>

Sure, thats the correct way going forward if you want to use <assign>.
However, then your timer needs to be part of the datamodel (there are
some examples of this usage in the Commons SCXML test cases [4]).

Given that a tool has the luxury of not being the runtime, in the end
we take what it generates FWIW.

Incidently, if this tooling is publicly available (either open source
or commercially) it would be great if you could put a pointer to it on
the Commons SCXML wiki [5]. I know there have been numerous requests
for that on this list alone. Thanks.

-Rahul

(long, possibly fragmented URLs below):

[1] http://jakarta.apache.org/commons/scxml/guide/datamodel.html
[2] http://jakarta.apache.org/commons/scxml/guide/custom-actions.html
[3] http://jakarta.apache.org/commons/scxml/issue-tracking.html
[4] 
http://svn.apache.org/repos/asf/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/
[5] http://wiki.apache.org/jakarta-commons/SCXML/HomePage



--David


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to