summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-11-12 18:56:38 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-11-12 18:56:38 (GMT)
commitc95be52b02e921d4ba8b3e707cd2f6239ce9c99e (patch)
treef30012410b30788f37df1122fde18b75316a4417 /test
parentba6950d9968f151247d873b414c3ff0fd513f4ca (diff)
downloaduscxml-c95be52b02e921d4ba8b3e707cd2f6239ce9c99e.zip
uscxml-c95be52b02e921d4ba8b3e707cd2f6239ce9c99e.tar.gz
uscxml-c95be52b02e921d4ba8b3e707cd2f6239ce9c99e.tar.bz2
Data model access example in Java
Diffstat (limited to 'test')
-rw-r--r--test/uscxml/dom/TestData.json10
-rw-r--r--test/uscxml/dom/TestData.xml7
-rw-r--r--test/uscxml/dom/test-xml-access.scxml23
3 files changed, 40 insertions, 0 deletions
diff --git a/test/uscxml/dom/TestData.json b/test/uscxml/dom/TestData.json
new file mode 100644
index 0000000..a07a5d9
--- /dev/null
+++ b/test/uscxml/dom/TestData.json
@@ -0,0 +1,10 @@
+{
+ "id": 1,
+ "name": "Foo",
+ "price": 123,
+ "tags": [ "Bar", "Eek" ],
+ "stock": {
+ "warehouse": 300,
+ "retail": 20,
+ }
+}
diff --git a/test/uscxml/dom/TestData.xml b/test/uscxml/dom/TestData.xml
new file mode 100644
index 0000000..3160cfd
--- /dev/null
+++ b/test/uscxml/dom/TestData.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<note importance="urgent">
+ <to>Tove</to>
+ <from>Jani</from>
+ <heading>Reminder</heading>
+ <body>Don't forget me this weekend!</body>
+</note> \ No newline at end of file
diff --git a/test/uscxml/dom/test-xml-access.scxml b/test/uscxml/dom/test-xml-access.scxml
new file mode 100644
index 0000000..a637c00
--- /dev/null
+++ b/test/uscxml/dom/test-xml-access.scxml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<scxml datamodel="ecmascript">
+ <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js"/>
+ <datamodel>
+ <data id="cmplx1" src="TestData.json"/>
+ <data id="cmplx2" src="TestData.xml"/>
+ </datamodel>
+ <state id="s1">
+ <onentry>
+ <log label="cmplx1" expr="cmplx1.name"/>
+ <log label="cmplx1" expr="cmplx1.price"/>
+ <script>dump(cmplx1)</script>
+
+ <log label="cmplx2" expr="cmplx2.getAttribute('importance')"/>
+ <script>
+ var node = document.evaluate('//to', cmplx2).asString();
+ dump(node);
+ </script>
+ </onentry>
+ <transition target="done"/>
+ </state>
+ <final id="done"/>
+</scxml>