commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [1/2] commons-scxml git commit: SCXML-242: Providing JSON base datamodel as replacement for XML/XPath See: https://issues.apache.org/jira/browse/SCXML-242 - adding FasterXML Jackson as (default) json parser - adding new ContentParser to encapsulate Data
Date Sat, 26 Dec 2015 17:50:13 GMT
Repository: commons-scxml
Updated Branches:
  refs/heads/master 7b3a237b2 -> 6af929eb6


http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml b/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml
deleted file mode 100644
index 6811bc6..0000000
--- a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-<!-- A fictitious state machine used by test cases. Meant to illustrate
-     prefixed XPath expressions in the Commons SCXML Data() function -->
-<scxml xmlns="http://www.w3.org/2005/07/scxml"
-       version="1.0"
-       datamodel="jexl"
-       initial="ten">
-
-    <!-- Start with same prefixes, defined in two different places -->
-    <state id="ten">
-
-        <datamodel>
-            <data id="data10" xmlns:ns1="http://namespace.test.domain/1">
-                <root xmlns="">
-                    <ns1:foo>
-                      <bar>10</bar>
-                    </ns1:foo>
-                </root>
-            </data>
-        </datamodel>
-
-        <transition xmlns:ns1="http://namespace.test.domain/1"
-                    event="done.state.ten" cond="Data('string($data10/root/ns1:foo/bar)') eq 10"
-                    target="twenty" />
-
-    </state>
-
-    <!-- Already defined (and different) prefixes -->
-    <state id="twenty" xmlns:ns1="http://namespace.test.domain/1"
-                       xmlns:ns2="http://namespace.test.domain/2"
-                       xmlns:ns3="http://namespace.test.domain/1"
-                       xmlns:ns4="http://namespace.test.domain/2">
-
-        <datamodel>
-            <!-- Start with a prefixless XPath -->
-            <data id="data20">
-                <ns1:root>
-                    <ns2:foo>20</ns2:foo>
-                </ns1:root>
-            </data>
-        </datamodel>
-
-        <transition event="done.state.twenty" cond="Data('string($data20/ns3:root/ns4:foo)') eq 20"
-                    target="thirty" />
-
-    </state>
-
-    <!-- XPath looking at attribute -->
-    <state id="thirty">
-
-        <datamodel>
-            <!-- Start with a prefixless XPath -->
-            <data id="data30">
-                <root xmlns="http://namespace.test.domain/1">
-                    <foo xmlns="http://namespace.test.domain/2"
-                         xmlns:ns1="http://namespace.test.domain/3"
-                         ns1:content="30"/>
-                </root>
-            </data>
-        </datamodel>
-
-        <transition event="done.state.thirty"
-         xmlns:ns1="http://namespace.test.domain/1"
-         xmlns:ns2="http://namespace.test.domain/2"
-         xmlns:ns3="http://namespace.test.domain/3"
-         cond="Data('string($data30/ns1:root/ns2:foo/@ns3:content)') eq 30"
-         target="forty" />
-
-    </state>
-
-    <final id="forty"/>
-
-</scxml>
-

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml b/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml
deleted file mode 100644
index 9dcc9ad..0000000
--- a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml
+++ /dev/null
@@ -1,255 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-<!-- A fictitious state machine used by test cases. Meant to illustrate
-     prefixed XPath expressions in the Commons SCXML Data() function.
-     Used by org.apache.commons.scxml2.NamespacePrefixedPathsTest.
-     Also serves as testing the underlying functionality of the
-     underlying parsing technology -->
-<scxml xmlns="http://www.w3.org/2005/07/scxml"
-       xmlns:cs="http://commons.apache.org/scxml"
-       version="1.0"
-       datamodel="jexl"
-       initial="ten">
-
-     <!-- Root data model -->
-     <datamodel>
-
-        <!-- We'll use this for XPaths -->
-        <data id="rootdata"
-              xmlns:ns1="scheme://namespace.test.domain/1"
-              xmlns:ns2="scheme://namespace.test.domain/2"
-              xmlns:ns3="scheme://namespace.test.domain/3">
-             <ns1:root>
-                <ns2:foo>
-                  <ns3:bar>1</ns3:bar>
-                </ns2:foo>
-            </ns1:root>
-        </data>
-
-        <!-- We'll use this for the JUnit test
-             NamespacePrefixedPathsTest.java (scxml package) -->
-        <data id="retval" />
-
-    </datamodel>
-
-    <!-- State data model -->
-    <state id="ten">
-
-        <datamodel>
-
-            <data id="data10" xmlns:ns4="scheme://namespace.test.domain/1">
-                <root xmlns="">
-                    <ns4:foo>
-                      <bar>10</bar>
-                    </ns4:foo>
-                </root>
-            </data>
-
-        </datamodel>
-
-        <onentry>
-            <cs:var xmlns:pre1="scheme://namespace.test.domain/1"
-                    xmlns:pre2="scheme://namespace.test.domain/2"
-                    xmlns:pre3="scheme://namespace.test.domain/3"
-                    name="tentest"
-                    expr="Data('number($rootdata/pre1:root/pre2:foo/pre3:bar)') + Data('number($data10/root/pre1:foo/bar)')" />
-        </onentry>
-
-        <transition event="done.state.ten" cond="tentest eq 11" target="twenty" />
-
-        <onexit>
-            <assign location="retval" expr="tentest" />
-        </onexit>
-
-    </state>
-
-    <!-- Already defined (and different) prefixes -->
-    <state id="twenty" xmlns:ns1="scheme://namespace.test.domain/1"
-                       xmlns:ns2="scheme://namespace.test.domain/2"
-                       xmlns:ns3="scheme://namespace.test.domain/3">
-
-        <datamodel>
-
-            <data id="data20">
-                <ns1:root>
-                    <ns2:foo>20</ns2:foo>
-                </ns1:root>
-            </data>
-
-        </datamodel>
-
-        <onentry>
-            <assign location="Location('$rootdata/ns1:root/ns2:foo/ns3:bar')" expr="2" />
-        </onentry>
-
-
-        <!-- Redefine namespace prefixes -->
-        <transition event="done.state.twenty"
-                    xmlns:ns1="scheme://namespace.test.domain/1"
-                    xmlns:ns2="scheme://namespace.test.domain/2"
-                    cond="Data('string($data20/ns1:root/ns2:foo)') eq 20 and Data('string($rootdata/ns1:root/ns2:foo/ns3:bar)') eq 2"
-                    target="thirty" />
-
-        <onexit>
-
-            <!-- Redefine different prefixes bound to above namespaces -->
-            <if xmlns:pre1="scheme://namespace.test.domain/1"
-                xmlns:pre2="scheme://namespace.test.domain/2"
-                cond="Data('number($data20/pre1:root/pre2:foo)') lt 20">
-
-                <assign location="retval" expr="'Less than 20'" />
-
-            <elseif cond="Data('number($data20/pre1:root/pre2:foo)') eq 20" />
-
-                <assign location="retval" expr="'Equal to 20'" />
-
-            <else/>
-
-                <assign location="retval" expr="'Greater than 20'" />
-
-            </if>
-
-        </onexit>
-
-    </state>
-
-    <!-- XPath looking at attribute -->
-    <state id="thirty">
-
-        <datamodel>
-
-            <data id="data30">
-                <root xmlns="scheme://namespace.test.domain/1">
-                    <foo xmlns="scheme://namespace.test.domain/2"
-                         xmlns:ns1="scheme://namespace.test.domain/3"
-                         ns1:attfoo="30" attbar="300"/>
-                </root>
-            </data>
-
-        </datamodel>
-
-        <transition event="done.state.thirty"
-         xmlns:ns1="scheme://namespace.test.domain/1"
-         xmlns:ns2="scheme://namespace.test.domain/2"
-         xmlns:ns3="scheme://namespace.test.domain/3"
-         cond="Data('number($data30/ns1:root/ns2:foo/@ns3:attfoo)') + Data('number($data30/ns1:root/ns2:foo/@attbar)') eq 330"
-         target="forty" />
-
-    </state>
-
-    <!-- Multiple data, already defined prefixes -->
-    <state id="forty" xmlns:ns1="scheme://namespace.test.domain/1"
-                      xmlns:ns2="scheme://namespace.test.domain/2"
-                      xmlns:ns3="scheme://namespace.test.domain/3"
-                      xmlns:ns4="scheme://namespace.test.domain/4">
-
-        <datamodel>
-
-            <data id="data40">
-                <root xmlns="">
-                    <ns1:foo ns2:attfoo="40"/>
-                </root>
-            </data>
-
-            <data id="data41">
-                <ns3:root>
-                    <ns4:foo>41</ns4:foo>
-                </ns3:root>
-            </data>
-
-        </datamodel>
-
-        <transition event="done.state.forty"
-         cond="Data('number($data40/root/ns1:foo/@ns2:attfoo)') + Data('number($data41/ns3:root/ns4:foo)') eq 81"
-         target="fifty" />
-
-    </state>
-
-    <!-- Multiple data, prefixes on elements -->
-    <state id="fifty">
-
-        <datamodel>
-
-            <data id="data50"  xmlns:ns1="scheme://namespace.test.domain/1"
-                                 xmlns:ns2="scheme://namespace.test.domain/2"
-                                 xmlns:ns3="scheme://namespace.test.domain/3">
-                <ns1:root>
-                    <ns2:foo ns3:attfoo="50"/>
-                </ns1:root>
-            </data>
-
-            <data id="data51" xmlns:ns3="scheme://namespace.test.domain/3"
-                                xmlns:ns4="scheme://namespace.test.domain/4">
-                <ns3:root>
-                    <ns4:foo attfoo="51"/>
-                </ns3:root>
-            </data>
-
-        </datamodel>
-
-        <transition event="done.state.fifty"
-         xmlns:ns1="scheme://namespace.test.domain/1"
-         xmlns:ns2="scheme://namespace.test.domain/2"
-         xmlns:ns3="scheme://namespace.test.domain/3"
-         xmlns:ns4="scheme://namespace.test.domain/4"
-         cond="Data('number($data50/ns1:root/ns2:foo/@ns3:attfoo)') + Data('number($rootdata/ns1:root/ns2:foo/ns3:bar)') eq 52"
-         target="sixty" />
-
-    </state>
-
-    <!-- Multiple data, prefixes on datamodel and transition elements -->
-    <state id="sixty">
-
-        <datamodel xmlns:ns1="scheme://namespace.test.domain/1"
-                   xmlns:ns2="scheme://namespace.test.domain/2"
-                   xmlns:ns3="scheme://namespace.test.domain/3"
-                   xmlns:ns4="scheme://namespace.test.domain/4">
-
-            <data id="data60">
-                <root xmlns="">
-                    <ns1:foo ns2:attfoo="60"/>
-                </root>
-            </data>
-
-            <data id="data61">
-                <ns3:root>
-                    <ns4:foo attfoo="61"/>
-                </ns3:root>
-            </data>
-
-        </datamodel>
-
-        <transition event="done.state.sixty"
-         xmlns:pre1="scheme://namespace.test.domain/1"
-         xmlns:pre2="scheme://namespace.test.domain/2"
-         xmlns:pre3="scheme://namespace.test.domain/3"
-         xmlns:pre4="scheme://namespace.test.domain/4"
-         cond="Data('number($data60/root/pre1:foo/@pre2:attfoo)') + Data('number($data61/pre3:root/pre4:foo/@attfoo)') eq 121"
-         target="seventy">
-
-            <!-- should be 121 -->
-            <log expr="Data('number($data60/root/pre1:foo/@pre2:attfoo)') + Data('number($data61/pre3:root/pre4:foo/@attfoo)')"/>
-
-        </transition>
-
-    </state>
-
-    <final id="seventy"/>
-
-</scxml>
-

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml b/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml
deleted file mode 100644
index 85613b5..0000000
--- a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-<!-- A fictitious state machine used by test cases.
-     Meant to illustrate the usage of SCXML <datamodel> element
-     to persist some _event.data -->
-<scxml xmlns="http://www.w3.org/2005/07/scxml"
-       version="1.0"
-       datamodel="jexl"
-       initial="ten">
-
-    <!-- Root or document datamodel -->
-    <datamodel>
-        <data id="payload"/>
-    </datamodel>
-
-    <state id="ten">
-        <transition event="done.state.ten" target="twenty">
-            <assign location="payload" expr="_event.data" />
-        </transition>
-    </state>
-
-    <state id="twenty">
-        <transition event="done.state.twenty" target="thirty" />
-        <onexit>
-            <log label="Persisted event.data.one" expr="payload.one"/>
-            <log label="Persisted event.data.two" expr="payload.two"/>
-        </onexit>
-    </state>
-
-    <final id="thirty"/>
-
-</scxml>
-

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-05.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-05.xml b/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-05.xml
index 05a1ee3..b1f0d94 100644
--- a/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-05.xml
+++ b/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-05.xml
@@ -24,44 +24,54 @@
     <datamodel>
 
       <data id="airline">
-        <flight xmlns="">
-          <origin/>
-          <destination/>
-          <trip>round</trip>
-          <class>economy</class>
-          <meal/>
-          <dates>
-            <startdate>01/01/2009</startdate>
-            <enddate>01/05/2009</enddate>
-          </dates>
-          <dates>
-            <startdate>01/26/2009</startdate>
-            <enddate>01/31/2009</enddate>
-          </dates>
-        </flight>
+        {
+          "flight" :
+          {
+            "origin" : null,
+            "destination" : null,
+            "trip" : "round",
+            "class" : "economy",
+            "meal" : null,
+            "dates" :
+            [
+              {
+                "startdate" : "01/01/2009",
+                "enddate" : "01/05/2009"
+              },
+              {
+                "startdate" : "01/26/2009",
+                "enddate" : "01/31/2009"
+              }
+            ]
+          }
+        }
       </data>
 
       <data id="hotel">
-        <hotel xmlns="">
-          <stay>
-            <delete>foo</delete>
-          </stay>
-          <adults>1</adults>
-          <children>0</children>
-          <rooms>1</rooms>
-          <rate/>
-        </hotel>
+        {
+          "hotel" :
+          {
+            "stay" :
+            {
+              "delete" : "foo"
+            },
+            "adults" : 1,
+            "children" : 0,
+            "rooms" : 1,
+            "rate" : null
+          }
+        }
       </data>
 
     </datamodel>
 
     <state id="start">
         <onentry>
-            <log label="XML subtree copy - delete (should be foo)" expr="Data('string($hotel/hotel/stay/delete)')"/>
-            <assign location="Location('$hotel/hotel/stay')" expr="Data('$airline/flight/dates[2]/*')"/>
-            <log label="XML subtree copy - delete (should be empty)" expr="Data('string($hotel/hotel/stay/delete)')"/>
+            <log label="subtree copy - delete (should be foo)" expr="hotel.hotel.stay['delete']"/>
+            <assign location="hotel.hotel.stay" expr="airline.flight.dates[1]"/>
+            <log label="subtree copy - delete (should be null)" expr="hotel.hotel.stay['delete']"/>
         </onentry>
-        <transition cond="Data('string($hotel/hotel/stay/startdate)') eq '01/26/2009'" target="end" />
+        <transition cond="hotel.hotel.stay.startdate eq '01/26/2009'" target="end" />
     </state>
 
     <final id="end"/>

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/env/jexl/eventdata-03.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/env/jexl/eventdata-03.xml b/src/test/java/org/apache/commons/scxml2/env/jexl/eventdata-03.xml
index f7bbb30..118bb1a 100644
--- a/src/test/java/org/apache/commons/scxml2/env/jexl/eventdata-03.xml
+++ b/src/test/java/org/apache/commons/scxml2/env/jexl/eventdata-03.xml
@@ -22,12 +22,7 @@
        initial="ten">
 
     <datamodel>
-        <data id="rootdata">
-            <root xmlns="">
-                <one>1</one>
-                <two>2</two>
-            </root>
-        </data>
+        <data id="rootdata">{ "root" : { "one" : 1, "two" : 2 } }</data>
     </datamodel>
 
     <state id="ten">
@@ -36,8 +31,8 @@
 
     <state id="twenty">
         <onentry>
-            <cs:var name="one" expr="Data('number($rootdata/root/one)')"/>
-            <cs:var name="two" expr="Data('number($rootdata/root/two)')"/>
+            <cs:var name="one" expr="rootdata.root.one"/>
+            <cs:var name="two" expr="rootdata.root.two"/>
             <send event="event.bar" namelist="one two"/>
         </onentry>
         <transition event="event.bar"

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java b/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
index f6ea857..a3809d2 100644
--- a/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
+++ b/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
@@ -27,8 +27,6 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
 // Tests for 4.3.1 in WD-scxml-20080516
 public class InvokeParamNameTest {
@@ -68,15 +66,14 @@ public class InvokeParamNameTest {
         Assert.assertEquals("foo", e.getValue());
     }
 
-    // Tests "param" element with a "name" attribute and "expr" attribute locating a node
+    // Tests "param" element with a "name" attribute and "expr" attribute locating a data id
     @Test
     public void testSoleNameLocation() throws Exception {
         trigger(); trigger();
-        final Element e = (Element)lastParams.values().iterator().next();
-        Assert.assertNotNull(e);
-        Assert.assertEquals("bar", e.getNodeName());
-        Assert.assertEquals(Node.TEXT_NODE, e.getFirstChild().getNodeType());
-        Assert.assertEquals("foo", e.getFirstChild().getNodeValue());
+        final Map m = (Map)lastParams.values().iterator().next();
+        Assert.assertNotNull(m);
+        Assert.assertEquals("bar", m.keySet().iterator().next());
+        Assert.assertEquals("foo", m.get("bar"));
     }
 
     public static class DummyInvoker implements Invoker {

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/invoke/invoker-04.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/invoke/invoker-04.xml b/src/test/java/org/apache/commons/scxml2/invoke/invoker-04.xml
index e68d567..37be004 100644
--- a/src/test/java/org/apache/commons/scxml2/invoke/invoker-04.xml
+++ b/src/test/java/org/apache/commons/scxml2/invoke/invoker-04.xml
@@ -25,9 +25,7 @@
        initial="wait">
 
     <datamodel>
-        <data id="foo">
-            <bar>foo</bar>
-        </data>
+        <data id="foo">{ "bar" : "foo"}</data>
     </datamodel>
 
     <state id="wait">
@@ -36,14 +34,14 @@
     
     <state id="first">
         <invoke src="FirstTestSrc" type="x-test">
-            <param name="ding" expr="Data('string($foo)')"/>
+            <param name="ding" expr="foo.bar"/>
         </invoke>
         <transition event="test.trigger" target="second"/>
     </state>
 
     <state id="second">
         <invoke src="SecondTestSrc" type="x-test">
-            <param name="dang" expr="Data('$foo/node()')"/>
+            <param name="dang" expr="foo"/>
         </invoke>
     </state>
 </scxml>

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/io/ContentParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/io/ContentParserTest.java b/src/test/java/org/apache/commons/scxml2/io/ContentParserTest.java
new file mode 100644
index 0000000..5ded49c
--- /dev/null
+++ b/src/test/java/org/apache/commons/scxml2/io/ContentParserTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml2.io;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ContentParserTest {
+
+    @Test
+    public void testTrimContent() throws Exception {
+        Assert.assertEquals(null, ContentParser.trimContent(null));
+        Assert.assertEquals("", ContentParser.trimContent(""));
+        Assert.assertEquals("", ContentParser.trimContent(" "));
+        Assert.assertEquals("", ContentParser.trimContent("  "));
+        Assert.assertEquals("", ContentParser.trimContent("   "));
+        Assert.assertEquals("", ContentParser.trimContent("\t\n\r"));
+        Assert.assertEquals("a", ContentParser.trimContent("a"));
+        Assert.assertEquals("a", ContentParser.trimContent(" a"));
+        Assert.assertEquals("a", ContentParser.trimContent("a "));
+        Assert.assertEquals("a", ContentParser.trimContent(" a "));
+    }
+
+    @Test
+    public void testSpaceNormalizeContent() throws Exception {
+        Assert.assertEquals(null, ContentParser.spaceNormalizeContent(null));
+        Assert.assertEquals("", ContentParser.spaceNormalizeContent(""));
+        Assert.assertEquals("a", ContentParser.spaceNormalizeContent("a"));
+        Assert.assertEquals("a", ContentParser.spaceNormalizeContent(" a"));
+        Assert.assertEquals("a", ContentParser.spaceNormalizeContent("a "));
+        Assert.assertEquals("a", ContentParser.spaceNormalizeContent(" a "));
+        Assert.assertEquals("a b c", ContentParser.spaceNormalizeContent("  a\tb \n \r c  "));
+    }
+
+    @Test
+    public void testParseJson() throws Exception {
+        ObjectMapper jsonObjectMapper = new ObjectMapper();
+        jsonObjectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+        jsonObjectMapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
+        // not by default configured, but much easier for unit-testing Java embedded JSON Strings
+        jsonObjectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
+
+        ContentParser contentParser = new ContentParser(jsonObjectMapper);
+
+        String jsonObjectString = "{ /*comment*/ 'string' : 'foobar', 'int' : 1, 'boolean' : false, 'null' : null }";
+        LinkedHashMap<String, Object> jsonObject = new LinkedHashMap<>();
+        jsonObject.put("string", "foobar");
+        jsonObject.put("int",new Integer(1));
+        jsonObject.put("boolean", Boolean.FALSE);
+        jsonObject.put("null", null);
+        Assert.assertEquals(jsonObject, contentParser.parseJson(jsonObjectString));
+
+        String jsonArrayString = "[" + jsonObjectString + "," + "# yaml comment\n" + jsonObjectString+"]";
+        ArrayList<Object> jsonArray = new ArrayList<>(2);
+        jsonArray.add(jsonObject);
+        jsonArray.add(jsonObject);
+        Assert.assertEquals(jsonArray, contentParser.parseJson(jsonArrayString));
+    }
+}

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java b/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java
index bc6b0f3..5d8b8f1 100644
--- a/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java
+++ b/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java
@@ -31,7 +31,7 @@ import org.junit.Test;
 public class DatamodelTest {
 
     /**
-     * Test the stateless model, simultaneous executions
+     * Test the stateless model (jexl), simultaneous executions
      */    
     @Test
     public void testDatamodelSimultaneousJexl() throws Exception {
@@ -42,38 +42,33 @@ public class DatamodelTest {
         Assert.assertFalse(exec01 == exec02);
         runtest(exec01, exec02);
     }
-    
+
+    /**
+     * Test the stateless model (Groovy), simultaneous executions
+     */
     @Test
-    public void testDatamodelNamespacePrefixedXPaths() throws Exception {
-        SCXMLExecutor exec01 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/jexl/datamodel-02.xml");
+    public void testDatamodelSimultaneousGroovy() throws Exception {
+        SCXMLExecutor exec01 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/groovy/datamodel-01.xml");
         exec01.go();
-        SCXMLExecutor exec02 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/jexl/datamodel-02.xml");
+        SCXMLExecutor exec02 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/groovy/datamodel-01.xml");
         exec02.go();
         Assert.assertFalse(exec01 == exec02);
         runtest(exec01, exec02);
     }
-    
+
+    /**
+     * Test the stateless model (Javascript), simultaneous executions
+     */
     @Test
-    public void testDatamodel04Jexl() throws Exception {
-        SCXMLExecutor exec01 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/jexl/datamodel-04.xml");
+    public void testDatamodelSimultaneousJavascript() throws Exception {
+        SCXMLExecutor exec01 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/javascript/datamodel-01.xml");
         exec01.go();
-        Set<EnterableState> currentStates = exec01.getStatus().getStates();
-        Assert.assertEquals(1, currentStates.size());
-        Assert.assertEquals("ten", currentStates.iterator().next().getId());
-        Map<String, Object> payload = new HashMap<String, Object>();
-        payload.put("one", "1");
-        payload.put("two", "2");
-        TriggerEvent te = new TriggerEvent("done.state.ten", TriggerEvent.SIGNAL_EVENT, payload);
-        SCXMLTestHelper.fireEvent(exec01, te);
-        currentStates = exec01.getStatus().getStates();
-        Assert.assertEquals(1, currentStates.size());
-        Assert.assertEquals("twenty", currentStates.iterator().next().getId());
-        SCXMLTestHelper.fireEvent(exec01, "done.state.twenty");
-        currentStates = exec01.getStatus().getStates();
-        Assert.assertEquals(1, currentStates.size());
-        Assert.assertEquals("thirty", currentStates.iterator().next().getId());
+        SCXMLExecutor exec02 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/javascript/datamodel-01.xml");
+        exec02.go();
+        Assert.assertFalse(exec01 == exec02);
+        runtest(exec01, exec02);
     }
-    
+
     @Test
     public void testDatamodel05Jexl() throws Exception {
         SCXMLExecutor exec01 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/jexl/datamodel-05.xml");
@@ -81,6 +76,20 @@ public class DatamodelTest {
         SCXMLTestHelper.assertState(exec01, "end");
     }
 
+    @Test
+    public void testDatamodel05Groovy() throws Exception {
+        SCXMLExecutor exec01 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/groovy/datamodel-05.xml");
+        exec01.go();
+        SCXMLTestHelper.assertState(exec01, "end");
+    }
+
+    @Test
+    public void testDatamodel05Javascript() throws Exception {
+        SCXMLExecutor exec01 = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/env/javascript/datamodel-05.xml");
+        exec01.go();
+        SCXMLTestHelper.assertState(exec01, "end");
+    }
+
     private void runtest(SCXMLExecutor exec01, SCXMLExecutor exec02) throws Exception {
         //// Interleaved
         // exec01

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/ParallelTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/ParallelTest.java b/src/test/java/org/apache/commons/scxml2/model/ParallelTest.java
index ec3a914..020784b 100644
--- a/src/test/java/org/apache/commons/scxml2/model/ParallelTest.java
+++ b/src/test/java/org/apache/commons/scxml2/model/ParallelTest.java
@@ -43,13 +43,13 @@ public class ParallelTest {
         SCXMLExecutor exec = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/model/parallel-03.xml");
         exec.go();
         SCXMLTestHelper.assertPostTriggerStates(exec, "dummy.event", new String[] { "para11", "para21" });
-        Object count = exec.getEvaluator().eval(exec.getGlobalContext(),"Data('string(root/root/count)')");
-        Assert.assertEquals("5.0", count.toString());
-        SCXMLTestHelper.assertPostTriggerStates(exec, "foo", new String[] { "para12", "para21" });
-        count = exec.getEvaluator().eval(exec.getGlobalContext(),"Data('string(root/root/count)')");
-        Assert.assertEquals("7.0", count.toString());
+        Object count = exec.getEvaluator().eval(exec.getGlobalContext(),"root.root.count");
+        Assert.assertEquals(5, count);
+        SCXMLTestHelper.assertPostTriggerStates(exec, "foo", new String[]{"para12", "para21"});
+        count = exec.getEvaluator().eval(exec.getGlobalContext(),"root.root.count");
+        Assert.assertEquals(7, count);
         SCXMLTestHelper.assertPostTriggerState(exec, "bar", "end");
-        count = exec.getEvaluator().eval(exec.getGlobalContext(),"Data('string(root/root/count)')");
-        Assert.assertEquals("14.0", count.toString());
+        count = exec.getEvaluator().eval(exec.getGlobalContext(),"root.root.count");
+        Assert.assertEquals(14, count);
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/SendTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/SendTest.java b/src/test/java/org/apache/commons/scxml2/model/SendTest.java
index 92ee6a8..2c1e5b7 100644
--- a/src/test/java/org/apache/commons/scxml2/model/SendTest.java
+++ b/src/test/java/org/apache/commons/scxml2/model/SendTest.java
@@ -52,8 +52,8 @@ public class SendTest {
         Map<String, Object> firstPayload = (Map<String, Object>) payloads.get(0);
         Assert.assertEquals("Only two in the namelist data expected.", 2, firstPayload.size());
 
-        Assert.assertEquals("Unexpected value for 'one'.", 1.0, firstPayload.get("one"));
-        Assert.assertEquals("Unexpected value for 'two'.", 2.0, firstPayload.get("two"));
+        Assert.assertEquals("Unexpected value for 'one'.", 1, firstPayload.get("one"));
+        Assert.assertEquals("Unexpected value for 'two'.", 2, firstPayload.get("two"));
 
         // Note: the standard allows specifying the value of the namelist attribute of the <send> element
         // as space-separated list of values, which implies an ordered sequence of items.

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/assign-src.json
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/assign-src.json b/src/test/java/org/apache/commons/scxml2/model/assign-src.json
new file mode 100644
index 0000000..ec27830
--- /dev/null
+++ b/src/test/java/org/apache/commons/scxml2/model/assign-src.json
@@ -0,0 +1,25 @@
+{
+  /*
+   * Licensed to the Apache Software Foundation (ASF) under one or more
+   * contributor license agreements.  See the NOTICE file distributed with
+   * this work for additional information regarding copyright ownership.
+   * The ASF licenses this file to You under the Apache License, Version 2.0
+   * (the "License"); you may not use this file except in compliance with
+   * the License.  You may obtain a copy of the License at
+   *
+   *     http://www.apache.org/licenses/LICENSE-2.0
+   *
+   * Unless required by applicable law or agreed to in writing, software
+   * distributed under the License is distributed on an "AS IS" BASIS,
+   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   * See the License for the specific language governing permissions and
+   * limitations under the License.
+   */
+
+  // Used in test of "src" attribute of assign element
+
+  "root" :
+  {
+    "a" : 10
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/assign-src.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/assign-src.xml b/src/test/java/org/apache/commons/scxml2/model/assign-src.xml
deleted file mode 100644
index cd3a214..0000000
--- a/src/test/java/org/apache/commons/scxml2/model/assign-src.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-<!-- Used in test of "src" attribute of assign element -->
-<root xmlns="">
-    <a>10</a>
-</root>

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/assign-test-01.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/assign-test-01.xml b/src/test/java/org/apache/commons/scxml2/model/assign-test-01.xml
index 31888ec..41ffb0e 100644
--- a/src/test/java/org/apache/commons/scxml2/model/assign-test-01.xml
+++ b/src/test/java/org/apache/commons/scxml2/model/assign-test-01.xml
@@ -17,7 +17,6 @@
 -->
 <!-- Test "src" attribute of assign element -->
 <scxml xmlns="http://www.w3.org/2005/07/scxml"
-       xmlns:rad="http://foo/bar"
        version="1.0"
        datamodel="jexl"
        initial="assign1">
@@ -25,23 +24,15 @@
   <state id="assign1">
 
     <datamodel>
-        <data id="foo">
-            <root xmlns="">
-                <foo/>
-            </root>
-        </data>
-        <data id="bar">
-            <root xmlns="">
-                <bar>5</bar>
-            </root>
-        </data>
+        <data id="foo">{ "root" : { "foo" : null } }</data>
+        <data id="bar">{ "root" : { "bar" : 5 } }</data>
     </datamodel>
 
     <onentry>
-        <assign location="Location('foo/root/foo')" src="assign-src.xml"/>
+        <assign location="foo.root.foo" src="assign-src.json"/>
     </onentry>
 
-    <transition cond="Data('number(foo/root/foo/root/a)') + Data('number(bar/root/bar)') eq 15"
+    <transition cond="foo.root.foo.root.a + bar.root.bar eq 15"
                 target="assign2" />
 
   </state>
@@ -49,19 +40,15 @@
   <state id="assign2">
 
     <datamodel>
-      <data id="jira51data1">
-          <rad:timeout>10</rad:timeout>
-      </data> 
-      <data id="jira51data2">
-          <rad:short xmlns="">20</rad:short>
-      </data>
+      <data id="jira51data1">{ "timeout" : 10 }</data>
+      <data id="jira51data2">{ "short" : 20 }</data>
     </datamodel>
 
     <onentry>
-        <assign location="Location('jira51data1/rad:timeout')" expr="Data('jira51data2/rad:short/text()')"/>
+        <assign location="jira51data1.timeout" expr="jira51data2.short"/>
     </onentry>
 
-    <transition cond="Data('number(jira51data1/rad:timeout)') eq 20"
+    <transition cond="jira51data1.timeout eq 20"
                 target="assign3" />
 
   </state>

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/assign-test-02.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/assign-test-02.xml b/src/test/java/org/apache/commons/scxml2/model/assign-test-02.xml
index d72dd81..b382e9b 100644
--- a/src/test/java/org/apache/commons/scxml2/model/assign-test-02.xml
+++ b/src/test/java/org/apache/commons/scxml2/model/assign-test-02.xml
@@ -15,32 +15,21 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
 -->
-<!-- Regress JIRA 89, incomplete child removal -->
-<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:rad="http://foo/bar" version="1.0"  datamodel="jexl" initial="assign1">
+<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"  datamodel="jexl" initial="assign1">
    <datamodel>
-       <data id="source">
-           <rad:foo>
-               <rad:a>1</rad:a>
-               <rad:b>2</rad:b>
-           </rad:foo>
-       </data>
-       <data id="destination">
-           <rad:bar>
-               <rad:a>3</rad:a>
-               <rad:b>4</rad:b>
-           </rad:bar>
-       </data>
+       <data id="source">{ "foo" : { "a" : 1, "b" : 2 } }</data>
+       <data id="destination">{ "bar" : { "a" : 3, "b" : 4 } }</data>
    </datamodel>
    <!-- verify the destination contents -->
    <state id="assign1">
-       <transition cond="Data('number(destination/rad:bar/rad:a)') eq 3 and Data('number(destination/rad:bar/rad:b)') eq 4" target="assign2" />
+       <transition cond="destination.bar.a eq 3 and destination.bar.b eq 4" target="assign2" />
    </state>
    <!-- copy the new contents and verify -->
    <state id="assign2">
        <onentry>
-           <assign location="Location('destination/rad:bar')" expr="Data('source/rad:foo/*')" />
+           <assign location="destination.bar" expr="source.foo" />
        </onentry>
-       <transition cond="Data('number(destination/rad:bar/rad:a)') eq 1 and Data('number(destination/rad:bar/rad:b)') eq 2" target="assign3" />
+       <transition cond="destination.bar.a eq 1 and destination.bar.b eq 2" target="assign3" />
    </state>
    <final id="assign3"/>
 </scxml>

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/cancel-test-01.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/cancel-test-01.xml b/src/test/java/org/apache/commons/scxml2/model/cancel-test-01.xml
index 2829d87..54c4bbb 100644
--- a/src/test/java/org/apache/commons/scxml2/model/cancel-test-01.xml
+++ b/src/test/java/org/apache/commons/scxml2/model/cancel-test-01.xml
@@ -22,12 +22,7 @@
        initial="ten">
 
     <datamodel>
-        <data id="rootdata">
-            <root xmlns="">
-                <one>1</one>
-                <two>2</two>
-            </root>
-        </data>
+        <data id="rootdata">{ "root" : { "one" : 1, "two" : 2 } }</data>
     </datamodel>
 
     <state id="ten">
@@ -35,8 +30,8 @@
         <transition event="event.foo" target="twenty" />
 
         <onexit>
-            <cs:var name="one" expr="Data('number($rootdata/root/one)')" />
-            <cs:var name="two" expr="Data('number($rootdata/root/two)')" />
+            <cs:var name="one" expr="rootdata.root.one" />
+            <cs:var name="two" expr="rootdata.root.two" />
             <send id="send123" event="event.bar" namelist="one two" delay="1500" />
         </onexit>
 

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/cancel-test-02.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/cancel-test-02.xml b/src/test/java/org/apache/commons/scxml2/model/cancel-test-02.xml
index d87b694..ac1c0d8 100644
--- a/src/test/java/org/apache/commons/scxml2/model/cancel-test-02.xml
+++ b/src/test/java/org/apache/commons/scxml2/model/cancel-test-02.xml
@@ -22,12 +22,7 @@
        initial="ten">
 
     <datamodel>
-        <data id="rootdata">
-            <root xmlns="">
-                <one>1</one>
-                <two>2</two>
-            </root>
-        </data>
+        <data id="rootdata">{ "root" : { "one" : 1, "two" : 2 } }</data>
     </datamodel>
 
     <state id="ten">
@@ -35,8 +30,8 @@
         <transition event="event.foo" target="twenty" />
 
         <onexit>
-            <cs:var name="one" expr="Data('number($rootdata/root/one)')" />
-            <cs:var name="two" expr="Data('number($rootdata/root/two)')" />
+            <cs:var name="one" expr="rootdata.root.one" />
+            <cs:var name="two" expr="rootdata.root.two" />
             <send id="send123" event="event.bar" namelist="one two" delay="1500" />
         </onexit>
 

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml b/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml
index 72194c1..94d7cfb 100644
--- a/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml
+++ b/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml
@@ -21,17 +21,13 @@
        initial="para">
 
     <datamodel>
-        <data id="root">
-            <root xmlns="">
-                <count>0</count>
-            </root>
-        </data>
+        <data id="root">{ "root" : { "count" : 0 } }</data>
     </datamodel>
 
     <parallel id="para">
 
         <onentry>
-            <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+            <assign location="root.root.count" expr="root.root.count + 1"/>
         </onentry>
 
         <state id="para1">
@@ -40,30 +36,30 @@
                 <transition target="para11"/>
             </initial>
             <onentry>
-                <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                <assign location="root.root.count" expr="root.root.count + 1"/>
             </onentry>
 
             <state id="para11">
                 <onentry>
-                      <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                      <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onentry>
                 <transition event="foo" target="para12"/>
                 <onexit>
-                      <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                      <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onexit>
             </state>
 
             <final id="para12">
                 <onentry>
-                    <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                    <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onentry>
                 <onexit>
-                    <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                    <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onexit>
             </final>
 
             <onexit>
-                <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                <assign location="root.root.count" expr="root.root.count + 1"/>
             </onexit>
 
         </state>
@@ -74,30 +70,30 @@
                 <transition target="para21"/>
             </initial>
             <onentry>
-                <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                <assign location="root.root.count" expr="root.root.count + 1"/>
             </onentry>
 
             <state id="para21">
                 <onentry>
-                    <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                    <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onentry>
                 <transition event="bar" target="para22"/>
                 <onexit>
-                    <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                    <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onexit>
             </state>
 
             <final id="para22">
                 <onentry>
-                    <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                    <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onentry>
                 <onexit>
-                    <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                    <assign location="root.root.count" expr="root.root.count + 1"/>
                 </onexit>
             </final>
 
             <onexit>
-                <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+                <assign location="root.root.count" expr="root.root.count + 1"/>
             </onexit>
 
         </state>
@@ -105,7 +101,7 @@
         <transition event="done.state.para" target="end"/>
 
         <onexit>
-            <assign location="Location('root/root/count')" expr="Data('number(root/root/count)') + 1"/>
+            <assign location="root.root.count" expr="root.root.count + 1"/>
         </onexit>
 
     </parallel>

http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/6af929eb/src/test/java/org/apache/commons/scxml2/model/send-test-01.xml
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/scxml2/model/send-test-01.xml b/src/test/java/org/apache/commons/scxml2/model/send-test-01.xml
index f7bbb30..118bb1a 100644
--- a/src/test/java/org/apache/commons/scxml2/model/send-test-01.xml
+++ b/src/test/java/org/apache/commons/scxml2/model/send-test-01.xml
@@ -22,12 +22,7 @@
        initial="ten">
 
     <datamodel>
-        <data id="rootdata">
-            <root xmlns="">
-                <one>1</one>
-                <two>2</two>
-            </root>
-        </data>
+        <data id="rootdata">{ "root" : { "one" : 1, "two" : 2 } }</data>
     </datamodel>
 
     <state id="ten">
@@ -36,8 +31,8 @@
 
     <state id="twenty">
         <onentry>
-            <cs:var name="one" expr="Data('number($rootdata/root/one)')"/>
-            <cs:var name="two" expr="Data('number($rootdata/root/two)')"/>
+            <cs:var name="one" expr="rootdata.root.one"/>
+            <cs:var name="two" expr="rootdata.root.two"/>
             <send event="event.bar" namelist="one two"/>
         </onentry>
         <transition event="event.bar"


Mime
View raw message