index.html 306 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>State Chart XML (SCXML): State Machine Notation for Control
Abstraction</title>
<style type="text/css">
code           { font-family: monospace; }

div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

ol.enumar      { list-style-type: decimal; }
ol.enumla      { list-style-type: lower-alpha; }
ol.enumlr      { list-style-type: lower-roman; }
ol.enumua      { list-style-type: upper-alpha; }
ol.enumur      { list-style-type: upper-roman; }


div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}

table {
        width:80%;
        border:1px solid #000;
        border-collapse:collapse;
        font-size:90%;
    }

td,th{
        border:1px solid #000;
        border-collapse:collapse;
        padding:5px;
    }   


caption{
        background:#ccc;
        font-size:140%;
        border:1px solid #000;
        border-bottom:none;
        padding:5px;
        text-align:center;
    }

img.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
p.caption {
  text-align: center
}

.RFC2119 {
  text-transform: lowercase;
  font-style: italic;
}
</style>

<link type="text/css" rel="stylesheet"
href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
</head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img width="72" height="48"
alt="W3C" src="http://www.w3.org/Icons/w3c_home" /></a></p>

<h1><a id="title" name="title" />State Chart XML (SCXML): State
Machine Notation for Control Abstraction</h1>

<h2><a id="w3c-doctype" name="w3c-doctype" />W3C Working Draft
<i>26</i> <i>April</i> <i>2011</i></h2>

<dl>
<dt>This version:</dt>

<dd><a
href="http://www.w3.org/TR/2011/WD-scxml-20110426/">http://www.w3.org/TR/2011/WD-scxml-20110426/</a></dd>

<dt>Latest version:</dt>

<dd><a
href="http://www.w3.org/TR/scxml/">http://www.w3.org/TR/scxml/</a></dd>

<dt>Previous version:</dt>

<dd><a
href="http://www.w3.org/TR/2010/WD-scxml-20101216/">http://www.w3.org/TR/2010/WD-scxml-20101216/</a></dd>

<dt>Editors:</dt>

<dd>Jim Barnett, Genesys (Editor-in-Chief)</dd>

<dd>Rahul Akolkar, IBM</dd>

<dd>RJ Auburn, Voxeo</dd>

<dd>Michael Bodell, Microsoft</dd>

<dd>Daniel C. Burnett, Voxeo</dd>

<dd>Jerry Carter, (until 2008, when at Nuance)</dd>

<dd>Scott McGlashan, HP</dd>

<dd>Torbjörn Lager, Invited Expert</dd>

<dd>Mark Helbing, (until 2006, when at Nuance)</dd>

<dd>Rafah Hosn, (until 2008, when at IBM)</dd>

<dd>T.V. Raman, (until 2005, when at IBM)</dd>

<dd>Klaus Reifenrath, (until 2006, when at Nuance)</dd>

<dd>No'am Rosenthal, (until 2009, when at Nokia)</dd>
</dl>

<p class="copyright"><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
© 2011 <a href="http://www.w3.org/"><acronym
title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym
title="Massachusetts Institute of Technology">MIT</acronym></a>, <a
href="http://www.ercim.eu/"><acronym
title="European Research Consortium for Informatics and Mathematics">
ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>),
All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">
liability</a>, <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">
trademark</a> and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
</div>

<hr />
<div>
<h2><a id="abstract" name="abstract" />Abstract</h2>

<p>This document describes SCXML, or the "State Chart extensible
Markup Language". SCXML provides a generic state-machine based
execution environment based on CCXML and Harel State Tables.</p>
</div>

<div>
<h2><a id="status" name="status" />Status of this Document</h2>

<p><em>This section describes the status of this document at the
time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest
revision of this technical report can be found in the <a
href="http://www.w3.org/TR/">W3C technical reports index</a> at
http://www.w3.org/TR/.</em></p>

<p>This document is the ninth Public Working Draft of SCXML
published on 26 April 2010 for review by W3C Members and other
interested parties, and has been developed by the <a
href="http://www.w3.org/Voice/">Voice Browser Working Group</a> as
part of the W3C <a
href="http://www.w3.org/Voice/Activity.html">Voice Browser
Activity</a>. The main difference from the previous draft is
corrections to the interpretation algorithm. A <a
href="diff.html">diff-marked version</a> of this document is also
available for comparison purposes.</p>

<p>Comments for this specification are welcomed to <a
href="mailto:www-voice@w3.org">www-voice@w3.org</a> (<a
href="http://lists.w3.org/Archives/Public/www-voice/">archives</a>).</p>

<p>This document was produced by a group operating under the <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
February 2004 W3C Patent Policy</a>. W3C maintains a <a
href="http://www.w3.org/2004/01/pp-impl/34665/status">public list
of any patent disclosures</a> made in connection with the
deliverables of the group; that page also includes instructions for
disclosing a patent. An individual who has actual knowledge of a
patent which the individual believes contains <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
Essential Claim(s)</a> must disclose the information in accordance
with <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
section 6 of the W3C Patent Policy.</a></p>

<p>Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated,
replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in
progress.</p>
</div>

<div class="toc">
<h2><a id="contents" name="contents" />Table of Contents</h2>

<p class="toc">1 <a href="#terminology">Terminology</a><br />
2 <a href="#overview">Overview</a><br />
3 <a href="#Basic">Core Constructs</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.1 <a
href="#CoreIntroduction">Introduction</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.2 <a
href="#scxml">&lt;scxml&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.3 <a
href="#state">&lt;state&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.4 <a
href="#parallel">&lt;parallel&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.5 <a
href="#transition">&lt;transition&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.6 <a
href="#initial">&lt;initial&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.7 <a
href="#final">&lt;final&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.8 <a
href="#onentry">&lt;onentry&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.9 <a
href="#onexit">&lt;onexit&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.10 <a
href="#history">&lt;history&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.11 <a
href="#LegalStateConfigurations">Legal State Configurations and
Specifications</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.12 <a href="#events">SCXML
Events</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.13 <a
href="#SelectingTransitions">Selecting and Executing
Transitions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;3.14 <a href="#IDs">IDs</a><br />
4 <a href="#executable">Executable Content</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.1 <a
href="#ExecutableIntroduction">Introduction</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.2 <a
href="#raise">&lt;raise&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.3 <a href="#if">&lt;if&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.4 <a
href="#elseif">&lt;elseif&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.5 <a href="#else">&lt;else&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.6 <a
href="#foreach">&lt;foreach&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.7 <a href="#log">&lt;log&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.8 <a
href="#profile-dependentexecutablecontent">Other Executable
Content</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.9 <a
href="#EvaluationofExecutableContent">Evaluation of Executable
Content</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;4.10 <a href="#extensibility">Extensibility
of Executable Content</a><br />
5 <a href="#data-module">Data Model and Data Manipulation</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.1 <a
href="#DataModelIntroduction">Introduction</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.2 <a
href="#datamodel">&lt;datamodel&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.3 <a href="#data">&lt;data&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.4 <a
href="#assign">&lt;assign&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.5 <a
href="#validate">&lt;validate&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.6 <a
href="#donedata">&lt;donedata&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.7 <a
href="#content">&lt;content&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.8 <a
href="#param">&lt;param&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.9 <a
href="#script">&lt;script&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.10 <a
href="#Expressions">Expressions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;5.11 <a href="#SystemVariables">System
Variables</a><br />
6 <a href="#external-module">External Communications</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;6.1 <a
href="#ExternalIntroduction">Introduction</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;6.2 <a href="#send">&lt;send&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;6.3 <a
href="#cancel">&lt;cancel&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;6.4 <a
href="#invoke">&lt;invoke&gt;</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;6.5 <a
href="#finalize">&lt;finalize&gt;</a><br />
</p>

<h3><a id="appendices" name="appendices" />Appendices</h3>

<p class="toc">A <a
href="#AlgorithmforSCXMLInterpretation">Algorithm for SCXML
Interpretation</a><br />
B <a href="#schemas">Schema</a><br />
C <a href="#conformance">Conformance</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;C.1 <a
href="#ConformingDocuments">Conforming Documents</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;C.2 <a
href="#ConformingProcessors">Conforming Processors</a><br />
D <a href="#profiles">Data Models</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;D.1 <a href="#minimal-profile">The Null
Data Model</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;D.2 <a href="#ecma-profile">The ECMAScript
Data Model</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;D.3 <a href="#xpath-profile">The XPath Data
Model</a><br />
E <a href="#eventioprocessors">Event I/O Processors</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;E.1 <a href="#SCXMLEventProcessor">SCXML
Event I/O Processor</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;E.2 <a
href="#BasicHTTPEventProcessor">Basic HTTP Event I/O
Processor</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;E.3 <a href="#DOMEventProcessor">DOM Event
I/O Processor</a><br />
F <a href="#relatedWork">Related Work</a><br />
G <a href="#Examples">Examples</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.1 <a href="#N1181C">Language
Overview</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.2 <a href="#N1182D">Microwave
Example</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.3 <a href="#MicrowaveParallel">Microwave
Example (Using parallel)</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.4 <a href="#N11844">Calculator
Example</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.5 <a href="#N1184F">Shale
Example</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.6 <a href="#invokeex">Examples of Invoke
and finalize</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.7 <a
href="#content_and_namespaces">Inline Content and
Namespaces</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;G.8 <a href="#custom_action">Custom Action
Elements</a><br />
H <a href="#references">References</a><br />
</p>
</div>

<hr />
<div class="body">
<div class="div1">
<h2><a id="terminology" name="terminology" />1 Terminology</h2>

<p>The key words <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em>, <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em>, <em
title="REQUIRED in RFC2119 context" class="RFC2119">REQUIRED</em>,
<em title="SHALL in RFC2119 context" class="RFC2119">SHALL</em>,
<em title="SHALL NOT in RFC2119 context" class="RFC2119">SHALL
NOT</em>, <em title="SHOULD in RFC2119 context"
class="RFC2119">SHOULD</em>, <em
title="SHOULD NOT in RFC2119 context" class="RFC2119">SHOULD
NOT</em>, <em title="RECOMMENDED in RFC2119 context"
class="RFC2119">RECOMMENDED</em>, <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em>, and <em
title="OPTIONAL in RFC2119 context" class="RFC2119">OPTIONAL</em>
in this specification are to be interpreted as described in <a
href="#RFC2119">[IETF RFC 2119]</a>.</p>

<p>The terms base URI and relative URI are used in this
specification as they are defined in <a href="#RFC2396">[IETF RFC
2396]</a>.</p>

<p>All sections not marked as "informative" are normative.</p>
</div>

<div class="div1">
<h2><a id="overview" name="overview" />2 Overview</h2>

<p>[This section is informative.]</p>

<p>This document outlines State Chart XML (SCXML), which is a
general-purpose event-based state machine language that combines
concepts from CCXML and Harel State Tables. CCXML <a
href="#CCXML">[W3C CCXML 1.0]</a> is an event-based state machine
language designed to support call control features in Voice
Applications (specifically including VoiceXML but not limited to
it). The CCXML 1.0 specification defines both a state machine and
event handing syntax and a standardized set of call control
elements. Harel State Tables are a state machine notation that was
developed by the mathematician David Harel <a
href="#Harel_Politi">[Harel and Politi]</a> and is included in UML
<a href="#UML">[UML 2.3]</a>. They offer a clean and well-thought
out semantics for sophisticated constructs such as a parallel
states. They have been defined as a graphical specification
language, however, and hence do not have an XML representation. The
goal of this document is to combine Harel semantics with an XML
syntax that is a logical extension of CCXML's state and event
notation.</p>

<p><a href="#Basic"><b>3 Core Constructs</b></a> presents the core
state machine concepts, while <a href="#executable"><b>4 Executable
Content</b></a> contains an extensible set of actions that the
state machine can take in response to events. <a
href="#data-module"><b>5 Data Model and Data Manipulation</b></a>
defines constructs for storing and modifying data, while <a
href="#external-module"><b>6 External Communications</b></a>
provides the capability of communicating with external
entities.</p>
</div>

<div class="div1">
<h2><a id="Basic" name="Basic" />3 Core Constructs</h2>

<div class="div2">
<h3><a id="CoreIntroduction" name="CoreIntroduction" />3.1
Introduction</h3>

<p>[This section is informative.]</p>

<div class="div3">
<h4><a id="BasicState" name="BasicState" />3.1.1 Basic State
Machine Notation</h4>

<p>The most basic state machine concepts are <a
href="#state"><b>3.3 &lt;state&gt;</b></a>, <a
href="#transition"><b>3.5 &lt;transition&gt;</b></a> and event (<a
href="#events"><b>3.12 SCXML Events</b></a>). Each state contains a
set of transitions that define how it reacts to events. Events can
be generated by the state machine itself or by external entities.
In a traditional state machine, the machine is always in a single
state. This state is called the active state. When an event occurs,
the state machine checks the transitions that are defined in the
active state. If it finds one that matches the event, it moves from
the active state to the state specified by the transition (called
the "target" of the transition.) Thus the target state becomes the
new active state.</p>

<p>The Harel state notation defines several extensions to these
basic notions. First of all, the state machine may take actions (as
defined in <a href="#executable"><b>4 Executable Content</b></a>)
while taking transitions. Specifically, each state may contain <a
href="#onentry"><b>3.8 &lt;onentry&gt;</b></a> and <a
href="#onexit"><b>3.9 &lt;onexit&gt;</b></a> actions. Transitions
may also contain actions. If a state machine takes transition T
from state S1 to state S2, it first performs the onexit actions in
S1, then the actions in T, then the onentry actions in S2.
Secondly, in addition to the 'event' attribute that specifies the
event(s) that can trigger it, transitions also have a 'cond'
attribute. If a transition has both 'event' and 'cond' attributes,
it will be selected only if an event is raised whose name matches
the 'event' attribute (see <a href="#EventDescriptors"><b>3.12.1
Event Descriptors</b></a> for details) and the 'cond' condition
evaluates to true. If the 'event' attribute is missing, the
transition is taken whenever the 'cond' evaluates to true. If more
than one transition matches, the first one in document order will
be taken. Thus, in the following example, the system will
transition to s1 when event e (or e.foo, etc.) occurs if x is equal
to 1, but will transition to s2 if event e (or e.foo, etc.) occurs
and x is not equal to 1, and will go to s3 if any other event
occurs.</p>

<div class="exampleInner">
<pre>
&lt;state id=s"&gt;
   &lt;transition event="e" cond="x==1" target="s1"/&gt;
   &lt;transition event="e" target="s2"/&gt;
   &lt;transition event="*" target="s3"/&gt;
&lt;/state&gt;
</pre>
</div>

<p>The data model can be changed only by the execution of
&lt;invoke&gt; or executable content. Therefore transitions with
missing 'event' attributes need be checked only after a transition
has been taken. See <a href="#AlgorithmforSCXMLInterpretation"><b>A
Algorithm for SCXML Interpretation</b></a> for details.</p>
</div>

<div class="div3">
<h4><a id="N10153" name="N10153" />3.1.2 Compound States</h4>

<p>One of the most powerful concepts in Harel notation is the idea
that states may have internal structure. In particular, a
&lt;state&gt; element may contain nested &lt;state&gt; elements.
Such a state is called a compound state and we speak of it as the
parent state, while the nested elements are child states. The child
states may themselves have nested children and the nesting may
proceed to any depth. Ultimately we will reach a state that does
not contain any child states. Such a state is called an atomic
state. When a compound state is active, one and only one of its
child states is active. Conversely, when an child state is active,
its parent state must be active too. Thus at any point we have a
set of active states, containing an atomic state and all of its
ancestors. (We will see in the next section that multiple atomic
states can be active at the same time.)</p>

<div class="div4">
<h5><a id="N10158" name="N10158" />3.1.2.1 Initial, Final, and
History States</h5>

<p>In the presence of compound states, transitions no longer simply
move from the current active state to a new active state, but from
one set of active states to another. (See <a
href="#LegalStateConfigurations"><b>3.11 Legal State Configurations
and Specifications</b></a> for details.) If the target of a
transition is an atomic state, the state machine will enter not
only the atomic state, but also any of its ancestor states that are
not already active. Conversely, a transition may take a compound
state as its target. In this case, one of the compound state's
children must also become active, but the transition does not
specify which one. In this case we look at the target state's <a
href="#initial"><b>3.6 &lt;initial&gt;</b></a> child which
specifies the state's default initial state, that is, the child
state to enter if the transition does not specify one. (If the
default initial state is itself compound, the state machine will
also enter its default initial state, and so on recursively until
it reaches an atomic state.) The presence of default initial states
provides a form of encapsulation, since a transition may select a
compound state as its target without understanding its internal
substate structure.</p>

<p>The default initial state of a compound state may also be
specified via the 'initial' attribute. The only difference between
the &lt;initial&gt; element and the 'initial' attribute is that the
&lt;initial&gt; element contains a &lt;transition&gt; element which
may in turn contain executable content which will be executed
before the default state is entered. If the 'initial' attribute is
specified instead, the specified state will be entered, but no
executable content will be executed. (If neither the
&lt;initial&gt; child or the 'initial' element is specified, the
default initial state is the first child state in document order.)
As an example, suppose that parent state S contains child states S1
and S2 in that order. If S specifies S1 as its default initial
state via the 'initial' attribute (or fails to specify any initial
state), then any transition that specifies S as its target will
result in the state machine entering S1 as well as S. In this case,
the result is exactly the same as if the transition had taken S1 as
its target. If, on the other hand, S specifies S1 as its default
initial state via an &lt;initial&gt; element containing a
&lt;transition&gt; with S1 as its target, the &lt;transition&gt;
can contain executable content which will execute before the
default entry into S1. In this case, there is a difference between
a transition that takes S as its target and one that takes S1 as
its target. In the former case, but not in the latter, the
executable content inside the &lt;initial&gt; transition will be
executed.</p>

<p>A compound state may also have final and history states as
children. <a href="#final"><b>3.7 &lt;final&gt;</b></a> is used to
signify that the parent state is in some sense "done" with its
processing. When a state machine enters a &lt;final&gt; substate of
a compound state, the parent state remains active, but the event
"done.state.<em>id</em>" is generated, where <em>id</em> is the
state id of the parent state. This event can trigger a transition
in any ancestor state (including the parent). If the transition
takes a target outside the parent state, the
"done.state.<em>id</em>" event in effect serves as a signal that it
is time to leave the parent state. <a href="#history"><b>3.10
&lt;history&gt;</b></a> allows for pause and resume semantics in
compound states. Before the state machine exits a compound state,
it records the state's active descendents. If the 'type' attribute
of the &lt;history&gt; state is set to "deep", the state machine
saves the state's full active descendent configuration, down to the
atomic descendant(s). If 'type' is set to "shallow", the state
machine remembers only which immediate child was active. After
that, if a transition takes a &lt;history&gt; child of the state as
its target, the state machine re-enters not only the parent
compound state but also the state(s) in the saved configuration.
Thus a transition with a deep history state as its target returns
to exactly where the state was when it was last exited, while a
transition with a shallow history state as a target re-enters the
previously active child state, but will enter the child's default
initial state (if the child is itself compound.)</p>
</div>

<div class="div4">
<h5><a id="N10176" name="N10176" />3.1.2.2 Compound States and
Transitions</h5>

<p>Compound states also affect how transitions are selected. When
looking for transitions, the state machine first looks in the most
deeply nested active state(s), i.e., in the atomic state(s) that
have no substates. If no transitions match in the atomic state, the
state machine will look in its parent state, then in the parent's
parent, etc. Thus transitions in ancestor states serve as defaults
that will be taken if no transition matches in a descendant state.
If no transition matches in any state, the event is discarded.</p>

<p>In the case of a transition located in a compound state, the
'type' attribute is significant. The behavior of a transition with
'type' of "external" (the default) is defined in terms of the
transition's source state (which is the state that contains the
transition), the transition's target state(or states), and the <a
href="#LCA">Least Common Ancestor (LCA)</a> of the source and
target states (which is the closest state that is an ancestor of
all the source and target states). When a transition is taken, the
state machine will exit all active states that are proper
descendants of the LCA, starting with the innermost one(s) and
working up to the immediate descendant(s) of the LCA. Then the
state machine enters the target state(s), plus any states that are
between it and the LCA, starting with the outermost one (i.e., the
immediate descendant of the LCA) and working down to the target
state(s). As states are exited, their &lt;onexit&gt; handlers are
executed. Then the executable content in the transition is
executed, followed by the &lt;onentry&gt; handlers of the states
that are entered. If the target state(s) of the transition is not
atomic, the state machine will enter their default initial states
recursively until it reaches an atomic state(s).</p>

<p>In the example below, assume that state s11 is active when event
'e' occurs. The source of the transition is state s1, its target is
state s21, and the LCA is state S. When the transition is taken,
first state S11 is exited, then state s1, then state s2 is entered,
then state s21. Note that the LCA S is neither entered nor exited.
For more details see <a href="#SelectingTransitions"><b>3.13
Selecting and Executing Transitions</b></a> and <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a>.</p>

<div class="exampleInner">
<pre>
&lt;state id="S" initial="s1"&gt;
   &lt;state id="s1" initial="s11"&gt;
      &lt;onexit&gt;
         &lt;log expr="'leaving s1'"/&gt;
     &lt;/onexit&gt;
     
     &lt;state id="s11"&gt;
        &lt;onexit&gt;
           &lt;log expr="'leaving s11'"/&gt;
        &lt;/onexit&gt;
     &lt;/state&gt;
     
     &lt;transition event="e" target="s21"&gt;
        &lt;log expr="'executing transition'"/&gt;
     &lt;/transition&gt;

   &lt;/state&gt;
  
   &lt;state id="s2" initial="s21"&gt;
      &lt;state id="s21"&gt;
         &lt;onentry&gt;
            &lt;log expr="'entering s21'"/&gt;
         &lt;/onentry&gt;
      &lt;/state&gt;
      &lt;onentry&gt;
         &lt;log expr="'entering s2'"/&gt;
      &lt;/onentry&gt;
   &lt;/state&gt;

   &lt;onentry&gt;
     &lt;log expr="'entering S'"/&gt;
   &lt;onentry&gt;   
   &lt;onexit&gt;
     &lt;log expr="'leaving S'"/&gt;
   &lt;onexit&gt;
&lt;/state&gt;

==== log output will be ======&gt;

leaving s11
leaving s1
executing transition
entering s2
entering s21
</pre>
</div>

<p>The behavior of transitions with 'type' of "internal" is
identical, except in the case of a transition whose source state is
a compound state and whose target(s) is a descendant of the source.
In such a case, an internal transition will not exit and re-enter
its source state, while an external one will, as shown in the
example below.</p>

<div class="exampleInner">
<pre>
&lt;state id="S" initial="s1"&gt;
   &lt;state id="s1" initial="s11"&gt;
      &lt;onentry&gt;
        &lt;log expr="entering S1"/&gt;
        &lt;/onentry&gt;
      &lt;onexit&gt;
         &lt;log expr="'leaving s1'"/&gt;
     &lt;/onexit&gt;
     
     &lt;state id="s11"&gt;
       &lt;onentry&gt;
        &lt;log expr="entering s11"/&gt;
       &lt;/onentry&gt;
        &lt;onexit&gt;
           &lt;log expr="'leaving s11'"/&gt;
        &lt;/onexit&gt;
     &lt;/state&gt;
     
     &lt;transition event="e" target="s11" type="internal"&gt;
        &lt;log expr="'executing transition'"/&gt;
     &lt;/transition&gt;

   &lt;/state&gt;
  


==== log output will be ======&gt;

leaving s11
executing transition
entering s11

=== if transition were external, log output would be ====&gt;

leaving s11
leaving s1
executing transition
entering s1
entering s11

</pre>
</div>

<p>If the 'target' on a &lt;transition&gt; is omitted, then the
value of 'type' does not have any effect and taking the transition
does not change the state configuration but does invoke the
executable content that is included in the transition. Note that
this is different from a &lt;transition&gt; whose 'target' is its
source state. In the latter case, the state is exited and
reentered, triggering execution of its &lt;onentry&gt; and
&lt;onexit&gt; executable content.</p>
</div>
</div>

<div class="div3">
<h4><a id="N10193" name="N10193" />3.1.3 Parallel States</h4>

<p>The &lt;parallel&gt; element represents a state whose children
execute in parallel. Like &lt;state&gt;, the &lt;parallel&gt;
element contains &lt;onentry&gt;, &lt;onexit&gt;,
&lt;transition&gt;, and &lt;state&gt; or &lt;parallel&gt; children.
However, the semantics of &lt;parallel&gt; are different. When a
&lt;state&gt; is active, exactly one of its children is active.
When a &lt;parallel&gt; element is active, <em>all</em> of its
children are active. Specifically, when the state machine enters
the parent &lt;parallel&gt; state, it also enters each child state.
The child states execute in parallel in the sense that any event
that is processed is processed in each child state independently,
and each child state may take a different transition in response to
the event. (Similarly, one child state may take a transition in
reponse to an event, while another child ignores it.) When all of
the children reach final states, the &lt;parallel&gt; element
itself is considered to be in a final state, and a completion event
done.state.<em>id</em> is generated, where <em>id</em> is the id of
the &lt;parallel&gt; element.</p>

<p>Transitions <em>within</em> the individual child elements
operate normally. However whenever a transition is taken with a
target <em>outside</em> the &lt;parallel&gt; element, the
&lt;parallel&gt; element and all of its child elements are exited
and the corresponding &lt;onexit&gt; handlers are executed. The
handlers for the child elements execute first, in document order,
followed by those of the parent &lt;parallel&gt; element, followed
by an action expression in the &lt;transition&gt; element, and then
the &lt;onentry&gt; handlers in the "target" state.</p>

<p>In the following example, parallel state 'p' has two children S1
and S2. Suppose a transition takes S1's child S12 as a target.
(Note that this is permitted even though S12 is not the default
initial state for S1 and that S11 is not, in fact, visited in the
course of this example). Upon this transition, the state machine,
in addition to enterering S1 and S12, will also enter S1's parallel
sibling S2 and its initial state S21. Once the transition has been
taken, p, S1, S2, S12, and S21 will all be active. If event 'e1'
occurs, it will cause S12 to transition to S1Final, and S21 to
transition to S22. Entering S1Final will cause the event
done.state.S1 to be generated. At this point, S1 is in a final
state, but S2 is still active. Now suppose event 'e2' occurs. This
will cause S22 to transition to S2Final, and the event
done.state.S2 will be generated. Furthermore, since all of p's
children are now in final states, the event 'done.state.p' will be
generated, which will cause the transition contained in p to be
triggered, exiting the entire region.</p>

<div class="exampleInner">
<pre>
&lt;parallel id="p"&gt;

    &lt;transition event="done.state.p" target="someOtherState"/&gt;

    &lt;state id="S1" initial="S11"&gt;
        &lt;state id="S11"&gt;
            &lt;transition event="e4" target="S12"/&gt;
        &lt;/state&gt;
        &lt;state id="S12"&gt;
            &lt;transition event="e1" target="S1Final"/&gt;
        &lt;/state&gt;
        &lt;final id="S1Final"/&gt;
    &lt;/state&gt; 

    &lt;state id="S2" initial="S21"&gt;
        &lt;state id=S21"&gt;
            &lt;transition event="e1" target="S22"/&gt;
        &lt;/state&gt;
        &lt;state id="S22"&gt;
            &lt;transition event="e2" target="S2Final/&gt;
        &lt;/state&gt;
        &lt;final id="S2Final"/&gt;
    &lt;/state&gt; 

&lt;/parallel&gt;
</pre>
</div>

<p>Note that the semantics of the &lt;parallel&gt; does not call
for multiple threads or truly concurrent processing. The children
of &lt;parallel&gt; execute in parallel in the sense that they are
all simultaneously active and each one independently selects
transitions for any event that is received. However, the parallel
children process the event in a defined, serial order, so no
conflicts or race conditions can occur. See <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for a detailed description of the semantics
&lt;parallel&gt; and the rest of SCXML.</p>
</div>
</div>

<div class="div2">
<h3><a id="scxml" name="scxml" />3.2 &lt;scxml&gt;</h3>

<p>The top-level wrapper element, which carries version
information. The actual state machine consists of its children.</p>

<div class="div3">
<h4><a id="scxml-attr" name="scxml-attr" />3.2.1 Attribute
Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>initial</td>
<td>false</td>
<td>none</td>
<td>IDREFS</td>
<td>none</td>
<td>A legal state specification. See <a
href="#LegalStateConfigurations"><b>3.11 Legal State Configurations
and Specifications</b></a> for details.</td>
<td>The id of the initial state(s) for the document. If not
specified, the default initial state is the first child state in
document order.</td>
</tr>

<tr>
<td>name</td>
<td>false</td>
<td>none</td>
<td>NMTOKEN</td>
<td>none</td>
<td>Any valid NMTOKEN</td>
<td>The name of this state machine. It is for purely informational
purposes.</td>
</tr>

<tr>
<td>xmlns</td>
<td>true</td>
<td>none</td>
<td>URI</td>
<td>none</td>
<td>The value must be "http://www.w3.org/2005/07/scxml".</td>
<td></td>
</tr>

<tr>
<td>version</td>
<td>true</td>
<td>none</td>
<td>decimal</td>
<td>none</td>
<td>The only legal value is "1.0"</td>
<td></td>
</tr>

<tr>
<td>datamodel</td>
<td>false</td>
<td>none</td>
<td>NMTOKEN</td>
<td>"none"</td>
<td>"none", "ecmascript", "xpath" or other platform-defined
values.</td>
<td>The datamodel that this document requires. "none" denotes the
Empty datamodel, "ecmascript" the ECMAScript datamodel, and "xpath"
the XPath datamodel, as defined in <a href="#profiles"><b>D Data
Models</b></a>.</td>
</tr>

<tr>
<td>binding</td>
<td>false</td>
<td />
<td>enum</td>
<td>"early"</td>
<td>"early", "late"</td>
<td>The data binding to use. See <a href="#DataBinding"><b>5.3.3
Data Binding and Scoping</b></a> for details.</td>
</tr>

<tr>
<td>exmode</td>
<td>false</td>
<td />
<td>enum</td>
<td>"lax"</td>
<td>"lax", "strict"</td>
<td>Determines whether the processor should silently ignore markup
that it does not support.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10242" name="N10242" />3.2.2 Children</h4>

<ul>
<li>&lt;state&gt; A compound or atomic state. Occurs zero or more
times. See <a href="#state"><b>3.3 &lt;state&gt;</b></a> for
details.</li>

<li>&lt;parallel&gt; A parallel state. Occurs zero or more times.
See <a href="#parallel"><b>3.4 &lt;parallel&gt;</b></a> for
details.</li>

<li>&lt;final&gt; A top-level final state in the state machine.
Occurs zero or more times. The SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> terminate
processing when the state machine reaches this state. See <a
href="#final"><b>3.7 &lt;final&gt;</b></a> for details.</li>

<li>&lt;datamodel&gt; Defines part or all of the datamodel. Occurs
0 or 1 times. See <a href="#datamodel"><b>5.2
&lt;datamodel&gt;</b></a></li>

<li>&lt;script&gt; Provides scripting capability. Occurs 0 or 1
times. <a href="#script"><b>5.9 &lt;script&gt;</b></a></li>
</ul>
</div>

<p>If 'exmode' is "lax", the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> silently
ignore any markup that it does not support, including markup in
non-scxml namespaces. (Examples of unsupported elements include
elements that are not part of the specified data model or
executable content that some other platform has defined as an
extension.) If 'exmode' is "strict", the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> treat
such markup as syntactically invalid and reject the document at
initialization time.</p>
</div>

<div class="div2">
<h3><a id="state" name="state" />3.3 &lt;state&gt;</h3>

<p>Holds the representation of a state.</p>

<div class="div3">
<h4><a id="N10273" name="N10273" />3.3.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>id</td>
<td>false</td>
<td>none</td>
<td>ID</td>
<td>none</td>
<td>A valid id as defined in <a href="#Schema">[XML
Schema]</a></td>
<td>The identifier for this state. See <a href="#IDs"><b>3.14
IDs</b></a> for details.</td>
</tr>

<tr>
<td>initial</td>
<td>false</td>
<td>May not be specified in conjunction with the &lt;initial&gt;
element. May only occur in states that have child &lt;state&gt; or
&lt;parallel&gt; elements.</td>
<td>IDREFS</td>
<td>none</td>
<td>A legal state specification. See <a
href="#LegalStateConfigurations"><b>3.11 Legal State Configurations
and Specifications</b></a> for details.</td>
<td>The id of the default initial state (or states) for this
state.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N102B0" name="N102B0" />3.3.2 Children</h4>

<ul>
<li>&lt;onentry&gt; Optional element holding executable content to
be run upon entering this &lt;state&gt;. Occurs 0 or more times.
See <a href="#onentry"><b>3.8 &lt;onentry&gt;</b></a></li>

<li>&lt;onexit&gt; Optional element holding executable content to
be run when exiting this &lt;state&gt;. Occurs 0 or more times. See
<a href="#onexit"><b>3.9 &lt;onexit&gt;</b></a></li>

<li>&lt;transition&gt; Defines an outgoing transition from this
state. Occurs 0 or more times. See <a href="#transition"><b>3.5
&lt;transition&gt;</b></a></li>

<li>&lt;initial&gt; In states that have substates, an optional
child which identifies the default initial state. Any transition
which takes the parent state as its target will result in the
statemachine also taking the transition contained inside the
&lt;initial&gt; element. See <a href="#initial"><b>3.6
&lt;initial&gt;</b></a></li>

<li>&lt;state&gt; Defines a sequential substate of the parent
state. Occurs 0 or more times.</li>

<li>&lt;parallel&gt; Defines a parallel substate. Occurs 0 or more
times. See <a href="#parallel"><b>3.4 &lt;parallel&gt;</b></a></li>

<li>&lt;final&gt;. Defines a final substate. Occurs 0 or more
times. See <a href="#final"><b>3.7 &lt;final&gt;</b></a>.</li>

<li>&lt;history&gt; A child pseudo-state which records the
descendant state(s) that the parent state was in the last time the
system transitioned <em>from</em> the parent. May occur 0 or more
times. See <a href="#history"><b>3.10 &lt;history&gt;</b></a>.</li>

<li>&lt;datamodel&gt; Defines part or all of the datamodel. Occurs
0 or 1 times. See <a href="#datamodel"><b>5.2
&lt;datamodel&gt;</b></a></li>

<li>&lt;invoke&gt; Invokes an external service. Occurs 0 or more
times. See <a href="#invoke"><b>6.4 &lt;invoke&gt;</b></a> for
details.</li>
</ul>
</div>

<p>[<a title="" id="atomic-state"
name="atomic-state">Definition</a>: An <b>atomic state</b> is one
that has no &lt;state&gt; or &lt;parallel&gt; children.]</p>

<p>[<a title="" id="compound-state"
name="compound-state">Definition</a>: A <b>compound state</b> is
one that has &lt;state&gt;, &lt;parallel&gt;, or &lt;final&gt;
children (or a combination of these).]</p>

<p>In a conformant SCXML document, a compound state <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> specify
either an "initial" attribute or an &lt;initial&gt; element, but
not both. See <a href="#initial"><b>3.6 &lt;initial&gt;</b></a> for
a discussion of the difference between the two notations. If
neither the "initial" attribute nor an &lt;initial&gt; element is
specified, the default initial state is the first child state in
document order.</p>
</div>

<div class="div2">
<h3><a id="parallel" name="parallel" />3.4 &lt;parallel&gt;</h3>

<p>The &lt;parallel&gt; element encapsulates a set of child states
which are simultaneously active when the parent element is
active.</p>

<div class="div3">
<h4><a id="N1030B" name="N1030B" />3.4.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>id</td>
<td>false</td>
<td />
<td>ID</td>
<td>none</td>
<td>A valid id as defined in <a href="#Schema">[XML Schema]</a>
</td>
<td>The identifier for this state. See <a href="#IDs"><b>3.14
IDs</b></a> for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10337" name="N10337" />3.4.2 Children</h4>

<ul>
<li>&lt;onentry&gt; Holds executable content to be run upon
entering the &lt;parallel&gt; element. Occurs 0 or more times. See
<a href="#onentry"><b>3.8 &lt;onentry&gt;</b></a></li>

<li>&lt;onexit&gt; Holds executable content to be run when exiting
this element. Occurs 0 or more times. See <a href="#onexit"><b>3.9
&lt;onexit&gt;</b></a></li>

<li>&lt;transition&gt; Defines an outgoing transition from this
state. Occurs 0 or more times. See <a href="#transition"><b>3.5
&lt;transition&gt;</b></a></li>

<li>&lt;state&gt; Defines a parallel substate region. Occurs 0 or
more times. See <a href="#state"><b>3.3 &lt;state&gt;</b></a>.</li>

<li>&lt;parallel&gt; Defines a nested set of parallel regions.
Occurs 0 or more times.</li>

<li>&lt;history&gt; A child which represents the state
configuration that this state was in the last time the system
transitioned <em>from</em> it. A transition with this history
pseudo-state as its target is in fact a transition to the set of
descendant states that were active the last time this state was
exited. Occurs 0 or more times. See <a href="#history"><b>3.10
&lt;history&gt;</b></a>.</li>

<li>&lt;datamodel&gt; Defines part or all of the datamodel. Occurs
0 or 1 times. See <a href="#datamodel"><b>5.2
&lt;datamodel&gt;</b></a></li>

<li>&lt;invoke&gt; Invokes an external service. Occurs 0 or more
times. See <a href="#invoke"><b>6.4 &lt;invoke&gt;</b></a> for
details.</li>
</ul>

<p>A conformant SCXML document <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
contain any transitions between parallel siblings. Specifically, if
states Si and Sj are children of a &lt;parallel&gt; element, no
transition may have Si (or a descendant of Si) as its source and Sj
(or a descendent of Sj) as its target.</p>
</div>
</div>

<div class="div2">
<h3><a id="transition" name="transition" />3.5
&lt;transition&gt;</h3>

<p>Transitions between states are triggered by events and
conditionalized via guard conditions. They may contain executable
content, which is executed when the transition is taken.</p>

<div class="div3">
<h4><a id="N10373" name="N10373" />3.5.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>event</td>
<td>false</td>
<td>At least one of 'event', 'cond' or 'target' must be
specified.</td>
<td>EventsTypes.datatype.</td>
<td>none</td>
<td>A space-separated list of event descriptors. See <a
href="#EventDescriptors"><b>3.12.1 Event Descriptors</b></a> for
details.</td>
<td>A list of designators of events that trigger this transition.
The transition will be taken only when an event is generated that
matches a descriptor on this list (see <a
href="#EventDescriptors"><b>3.12.1 Event Descriptors</b></a> for
details.) Also see <a href="#SelectingTransitions"><b>3.13
Selecting and Executing Transitions</b></a> and <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details on how transitions are selected.
See <a href="#schemas"><b>B Schema</b></a> for the definition of
the datatype.</td>
</tr>

<tr>
<td>cond</td>
<td>false</td>
<td>At least one of 'event', 'cond' or 'target' must be
specified.</td>
<td>Boolean expression</td>
<td>'true'</td>
<td>Any boolean expression.</td>
<td>The guard condition for this transition. The transition is
selected only if the condition evaluates to <code>true</code>. See
<a href="#ConditionalExpressions"><b>5.10.1 Conditional
Expressions</b></a> for details.</td>
</tr>

<tr>
<td>target</td>
<td>false</td>
<td>At least one of 'event', 'cond' or 'target' must be
specified.</td>
<td>IDREFS</td>
<td>none</td>
<td>A legal state specification. See <a
href="#LegalStateConfigurations"><b>3.11 Legal State Configurations
and Specifications</b></a> for details.</td>
<td>The identifier(s) of the state or parallel region to transition
to. See <a href="#SelectingTransitions"><b>3.13 Selecting and
Executing Transitions</b></a> and <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details.</td>
</tr>

<tr>
<td>type</td>
<td>false</td>
<td>None</td>
<td>enum</td>
<td>"external"</td>
<td>"internal" "external"</td>
<td>Determines whether the source state is exited in transitions
whose target state is a descendant of the source state. See <a
href="#SelectingTransitions"><b>3.13 Selecting and Executing
Transitions</b></a> for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N103E7" name="N103E7" />3.5.2 Children</h4>

<ul>
<li>The children of &lt;transition&gt; are executable content that
is run after all the &lt;onexit&gt; handlers and before the all
&lt;onentry&gt; handlers that are triggered by this transition. See
<a href="#executable"><b>4 Executable Content</b></a></li>
</ul>
</div>

<p><a href="#SelectingTransitions"><b>3.13 Selecting and Executing
Transitions</b></a> contains more detail on the semantics of
transitions.</p>
</div>

<div class="div2">
<h3><a id="initial" name="initial" />3.6 &lt;initial&gt;</h3>

<p>This element represents the default initial state for a complex
&lt;state&gt; element (i.e. one one containing child &lt;state&gt;
or &lt;parallel&gt; elements.</p>

<div class="div3">
<h4><a id="N103FB" name="N103FB" />3.6.1 Attribute Details</h4>

<p>None</p>
</div>

<div class="div3">
<h4><a id="N10400" name="N10400" />3.6.2 Children</h4>

<ul>
<li>&lt;transition&gt; A transition whose 'target' specifies the
default initial state(s). In a conformant SCXML document, this
transition <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> contain 'cond' or 'event' attributes,
and <em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
specify a non-null 'target' whose value is a valid state
specification (see <a href="#LegalStateConfigurations"><b>3.11
Legal State Configurations and Specifications</b></a> for details).
This transition <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> contain executable content.</li>
</ul>
</div>
</div>

<div class="div2">
<h3><a id="final" name="final" />3.7 &lt;final&gt;</h3>

<p>&lt;final&gt; represents a final state of an &lt;scxml&gt; or
compound &lt;state&gt; element.</p>

<div class="div3">
<h4><a id="N10419" name="N10419" />3.7.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>id</td>
<td>false</td>
<td />
<td>ID</td>
<td>none</td>
<td>A valid id as defined in <a href="#Schema">[XML
Schema]</a></td>
<td>The identifier for this state. See <a href="#IDs"><b>3.14
IDs</b></a> for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10444" name="N10444" />3.7.2 Children</h4>

<ul>
<li>&lt;onentry&gt; Optional element holding executable content to
be run upon entering this state. Occurs 0 or 1 times. See <a
href="#onentry"><b>3.8 &lt;onentry&gt;</b></a> for details.</li>

<li>&lt;onexit&gt; Optional element holding executable content to
be run when exiting this state. Occurs 0 or 1 times. See <a
href="#onexit"><b>3.9 &lt;onexit&gt;</b></a> for details.</li>

<li>&lt;donedata&gt; Optional element specifying data to be
included in the done.state.<em>id</em> or done.invoke.<em>id</em>
event. See <a href="#donedata"><b>5.6 &lt;donedata&gt;</b></a> for
details.</li>
</ul>
</div>

<p>When the state machine enters the &lt;final&gt; child of a
&lt;state&gt; element, the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> after
generate the event done.state.<em>id</em> after completion of the
&lt;onentry&gt; elements, where <em>id</em> is the id of the parent
state. When the state machine reaches the &lt;final&gt; child of an
&lt;scxml&gt; element, it <em title=" MUST in RFC2119 context"
class="RFC2119">MUST</em> terminate. See <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details. If the SCXML session was
triggered as the result by an &lt;invoke&gt; element in another
session, the SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> generate the event
done.invoke.<em>id</em> after termination and return it to the
other session, where <em>id</em> is the unique identifier generated
when the &lt;invoke&gt; element was executed. See <a
href="#invoke"><b>6.4 &lt;invoke&gt;</b></a> for details.</p>
</div>

<div class="div2">
<h3><a id="onentry" name="onentry" />3.8 &lt;onentry&gt;</h3>

<p>A wrapper element containing executable content to be executed
when the state is entered.</p>

<div class="div3">
<h4><a id="N10483" name="N10483" />3.8.1 Attribute Details</h4>

<p>None.</p>
</div>

<div class="div3">
<h4><a id="N10488" name="N10488" />3.8.2 Children</h4>

<p>The children of the &lt;onentry&gt; handler consist of
executable content as defined in <a href="#executable"><b>4
Executable Content</b></a>.</p>
</div>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> execute the &lt;onentry&gt; handlers of a
state in document order when the state is entered. In doing so, it
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> treat
each handler as a separate block of executable content. See <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details.</p>
</div>

<div class="div2">
<h3><a id="onexit" name="onexit" />3.9 &lt;onexit&gt;</h3>

<p>A wrapper element containing executable content to be executed
when the state is exited.</p>

<div class="div3">
<h4><a id="N104A1" name="N104A1" />3.9.1 Attribute Details</h4>

<p>None.</p>
</div>

<div class="div3">
<h4><a id="N104A6" name="N104A6" />3.9.2 Children</h4>

<p>The children of the &lt;onexit&gt; handler consist of executable
content as defined in <a href="#executable"><b>4 Executable
Content</b></a>.</p>
</div>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> execute the &lt;onexit&gt; handlers of a
state in document order when the state is exited. In doing so, it
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> treat
each handler as a separate block of executable content. See <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details.</p>
</div>

<div class="div2">
<h3><a id="history" name="history" />3.10 &lt;history&gt;</h3>

<p>The &lt;history&gt; pseudo-state allows allows a state machine
to remember its state configuration. A &lt;transition&gt; taking
the &lt;history&gt; state as its target will return the state
machine to this recorded configuration.</p>

<div class="div3">
<h4><a id="N104BF" name="N104BF" />3.10.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>id</td>
<td>false</td>
<td />
<td>ID</td>
<td>none</td>
<td>A valid id as defined in <a href="#Schema">[XML
Schema]</a></td>
<td>Identifier for this pseudo-state. See <a href="#IDs"><b>3.14
IDs</b></a> for details.</td>
</tr>

<tr>
<td>type</td>
<td>false</td>
<td />
<td>enum</td>
<td>"shallow"</td>
<td>"deep" or "shallow"</td>
<td>Determines whether the active atomic substate(s) of the current
state or only its immediate active substate(s) are recorded.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N104F8" name="N104F8" />3.10.2 Children</h4>

<ul>
<li>&lt;transition&gt; A transition whose 'target' specifies the
default history configuration. In a conformant SCXML document, this
transition <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> contain 'cond' or 'event' attributes,
and <em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
specify a non-null 'target' whose value is a valid state
specification (see <a href="#LegalStateConfigurations"><b>3.11
Legal State Configurations and Specifications</b></a>). This
transition <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> contain executable content. If 'type' is
"shallow", then the 'target' of this &lt;transition&gt; <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> contain
only immediate children of the parent state. Otherwise it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> contain
only atomic descendants of the parent. Occurs once. (Note that
under the definition of a legal state specification, if the parent
of the history element is &lt;state&gt; and the default state
specification contains a multiple states, then, in a conformant
SCXML document, the 'type' of the history element <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> be "deep"
and the states <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> be atomic descendents of a
&lt;parallel&gt; element that is itself a descendent of the parent
&lt;state&gt; element.)</li>
</ul>
</div>

<p>If the 'type' of a &lt;history&gt; element is "shallow", the
SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> record the immediately active children of
its parent before taking any transition that exits the parent. If
the 'type' of a &lt;history&gt; element is "deep", the SCXML
processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> record the active atomic descendents of
the parent before taking any transition that exits the parent.
Before the parent state has been visited for the first time, the
SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> treat the default history configuration,
which is specified by the 'target' of the &lt;history&gt; element's
&lt;transition&gt; child, as if it were the stored configuration.
If a transition is executed that takes the &lt;history&gt; state as
its target, the SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> behave as if the transition had taken the
stored state configuration as its target. (Note that in a
conformant SCXML document, a &lt;state&gt; or &lt;parallel&gt;
element <em title="MAY in RFC2119 context" class="RFC2119">MAY</em>
have both "deep" and "shallow" &lt;history&gt; children.)</p>
</div>

<div class="div2">
<h3><a id="LegalStateConfigurations"
name="LegalStateConfigurations" />3.11 Legal State Configurations
and Specifications</h3>

<p>[<a title="" id="state-active"
name="state-active">Definition</a>: A &lt;state&gt; or
&lt;parallel&gt; element is <b>active</b> if it has been entered by
a transition and has not subsequently been exited.]</p>

<p>[<a title="" id="state-configuration"
name="state-configuration">Definition</a>: The <b>state
configuration</b> of a state machine is the set of currently active
states. ]</p>

<p>An SCXML document places the state machine in an initial state
configuration at initialization time (via the 'initial' attribute
of the &lt;scxml&gt; element). Each transition that the state
machine takes thereafter places the state machine in another state
configuration (which need not be distinct from the former one.) A
conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the state machine only in legal
state configurations, where a legal state configuration is one that
meets the following conditions:</p>

<ul>
<li>The configuration contains exactly one child of the
&lt;scxml&gt; element.</li>

<li>The configuration contains one or more atomic states.</li>

<li>When the configuration contains an atomic state, it contains
all of its &lt;state&gt; and &lt;parallel&gt; ancestors.</li>

<li>When the configuration contains a non-atomic &lt;state&gt;, it
contains one and only one of the state's children.</li>

<li>If the configuration contains a &lt;parallel&gt; state, it
contains all of its children.</li>
</ul>

<p>It follows from this definition that if a state machine is in
more than one atomic state, the atomic states can be traced back
through a chain of &lt;state&gt; or &gt;parallel&gt; ancestors to a
single &lt;parallel&gt; ancestor.</p>

<p>The 'target' attribute of a &lt;transition&gt; (or the 'initial'
attribute of a &lt;state&gt; or &lt;scxml&gt; element) do not in
the general case specify a full legal state configuration since 1)
they can contain &lt;parallel&gt; or non-atomic &lt;state&gt;
elements 2) they do not contain the ancestors of the states in the
list. We therefore define a legal state specification to be a set
of states such that 1) no state is an ancestor of any other state
on the list, and 2) a full legal state configuration results when
all ancestors and default initial descendants have been added.
(Note that the process of adding default initial descendants is
recursive, since the 'initial' value may itself be non-atomic.) In
a conformant SCXML document, the value of an 'initial' attribute or
the 'target' of a &lt;transition&gt; <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> either be
empty or contain a legal state specification.</p>

<p>In a conformant SCXML document, there is an additional
requirement on the value of the 'initial' attribute of a
&lt;state&gt; and on the 'target' of a &lt;transition&gt; inside an
&lt;initial&gt; element: all the states <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> be
descendants of the containing &lt;state&gt; element.</p>
</div>

<div class="div2">
<h3><a id="events" name="events" />3.12 SCXML Events</h3>

<p>Events are one of the basic concepts in SCXML since they drive
most transitions. The internal structure of events is
platform-specific as long as the following external interface is
observed:</p>

<ul>
<li>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> make the data contained in an event
accessible via the 'event' variable, as specified in <a
href="#SystemVariables"><b>5.11 System Variables</b></a>.</li>

<li>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> make the event's name accessible via the
'event' variable, as specified in <a
href="#SystemVariables"><b>5.11 System Variables</b></a>. The SCXML
processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> use this same name value to match against
the 'event' attribute of transitions.</li>
</ul>

<p>For the most part, the set of events raised during the execution
of an SCXML document is application-specific and generated under
author control by use of the &lt;raise&gt; and &lt;send&gt;
elements. However, certain events are mandatory and generated
automatically by the interpreter. These are described in <a
href="#events"><b>3.12 SCXML Events</b></a>. Platforms <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> extend the
names of these automatically generated events by adding a suffix.
For example, a platform could extend done.state.<em>id</em> with a
timestamp suffix and generate done.state.<em>id.timestamp</em>
instead. Because any prefix of done.state.<em>id</em> is also a
prefix of done.state.<em>id.timestamp</em>, any transition that
matches the former event will also match the latter.</p>

<div class="div3">
<h4><a id="EventDescriptors" name="EventDescriptors" />3.12.1 Event
Descriptors</h4>

<p>Like an event name, an event descriptor is a series of
alphanumeric characters segemented into tokens by the "."
character. The 'event' attribute of a transition consists of one or
more such event descriptors separated by spaces.</p>

<p>[<a title="" id="transition-match"
name="transition-match">Definition</a>: A transition <b>matches</b>
an event if at least one of its event descriptors matches the
event's name. ]</p>

<p>[<a title="" id="event-match" name="event-match">Definition</a>:
An event descriptor <b>matches</b> an event name if its string of
tokens is an exact match or a prefix of the set of tokens in the
event's name. In all cases, the token matching is case sensitive.
]</p>

<p>For example, a transition with an 'event' attribute of "error
foo" will match event names "error", "error.send",
"error.send.failed", etc. (or "foo", "foo.bar" etc.) but would not
match events named "errors.my.custom",
"errorhandler.mistake","errOr.send" or "foobar".</p>

<p>For compatibility with CCXML, and to make the prefix matching
possibly more clear to a reader of the SCXML document, an event
descriptor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> also end with the wildcard '.*', which
matches zero or more tokens at the end of the processed event's
name. Note that a transition with 'event' of "error", one with
"error.", and one with "error.*" are functionally equivalent since
they are token prefixes of exactly the same set of event names.</p>

<p>An event designator consisting solely of "*" can be used as a
wildcard matching any sequence of tokens, and thus any event. Note
that this is different from a transition lacking the 'event'
attribute altogether. Such an eventless transition does not match
any event, but will be taken whenever its 'cond' attribute
evaluates to 'true'. As shown in <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a>, the SCXML interpreter will check for such
eventless transitions when it first enters a state, before it looks
for transitions driven by internal or external events.</p>
</div>

<div class="div3">
<h4><a id="ErrorEvents" name="ErrorEvents" />3.12.2 Errors</h4>

<p>Once the SCXML processor has begun executing a well-formed SCXML
document, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> signal any errors that occur by raising
SCXML events whose names begin with 'error.'. the processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place
these events in the internal event queue and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> process
them like any other event. (Note in particular, they are not
processed immediately if there are other events in the queue and
they are ignored if no transition is found that matches them.) Two
error events are defined in this specification:
'error.communication' and 'error.execution'. The former cover
errors occurring while trying to communicate with external
entities, such as those arising from &lt;send&gt; and
&lt;invoke&gt;, while the latter category consists of errors
internal to the execution of the document, such as those arising
from expression evaluation.</p>

<p>The set of error events may be extended in future versions of
this specification. However, the set of names beginning with
'error.platform' is reserved for platform- and application-specific
errors. Therefore applications and platforms <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> extend the
set of errors defined in this specification in two ways. First by
adding a suffix to an error name defined in this specification, and
second by using 'error.platform' with or without a suffix. In
addition, platforms <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> include additional information about the
nature of the error in the 'data' field of the event. See <a
href="#SystemVariables"><b>5.11 System Variables</b></a> for
details.</p>

<p>Note however that authors can arrange for otherwise unhandled
errors to cause the interpreter to exit by creating a transition
with "event" attribute of 'error' and a target of any top-level
final state (i.e. one that is a child of &lt;scxml&gt;). If such a
transition T is placed in a state S, it will cause the state
machine to terminate on any error that is raised in S or one of its
substates and is not handled by another transition that is placed
in a substate of S or in S and preceding T in document order.</p>
</div>

<div class="div3">
<h4><a id="errorsAndEvents" name="errorsAndEvents" />3.12.3 List of
Errors and Events</h4>

<p>The following events are generated automatically by the SCXML
implementation under conditions defined elsewhere in this
document.</p>

<table border="1" cellpadding="2" cellspacing="2"
summary="errors and events" width="100%">
<tbody>
<tr>
<th align="center">Name</th>
<th align="center">Description</th>
<th align="center">Defined in</th>
<th align="center">See also</th>
</tr>

<tr>
<td align="center">done.state.<em>id</em></td>
<td>Indicates that the state machine has entered a final substate
of state <em>id</em>.</td>
<td><a href="#final"><b>3.7 &lt;final&gt;</b></a></td>
<td><a href="#CoreIntroduction"><b>3.1 Introduction</b></a></td>
</tr>

<tr>
<td align="center">done.invoke.<em>id</em></td>
<td>Indicates that the invoked process with invokeid <em>id</em>
has completed processing.</td>
<td><a href="#invoke"><b>6.4 &lt;invoke&gt;</b></a></td>
<td><a href="#final"><b>3.7 &lt;final&gt;</b></a>, exitInterpreter
procedure in <a href="#AlgorithmforSCXMLInterpretation"><b>A
Algorithm for SCXML Interpretation</b></a> </td>
</tr>

<tr>
<td align="center">cancel.invoke.<em>id</em></td>
<td>Sent from an invoking session to an invoked session to
terminate its processing.</td>
<td><a href="#invokeimplementation"><b>6.4.3 Implementation of
&lt;invoke&gt;</b></a> </td>
<td><a href="#SCXMLEventProcessor"><b>E.1 SCXML Event I/O
Processor</b></a></td>
</tr>

<tr>
<td align="center">error.communication</td>
<td>Indicates that an error has occurred while trying to
communicate with an external entity.</td>
<td><a href="#ErrorEvents"><b>3.12.2 Errors</b></a></td>
<td><a href="#send"><b>6.2 &lt;send&gt;</b></a>, <a
href="#SCXMLEventProcessor"><b>E.1 SCXML Event I/O
Processor</b></a>, <a href="#BasicHTTPEventProcessor"><b>E.2 Basic
HTTP Event I/O Processor</b></a>, <a
href="#DOMEventProcessor"><b>E.3 DOM Event I/O
Processor</b></a></td>
</tr>

<tr>
<td align="center">error.execution</td>
<td>Indicates that an error internal to the execution of the
document has occurred, such as one arising from expression
evaluation.</td>
<td><a href="#ErrorEvents"><b>3.12.2 Errors</b></a></td>
<td><a href="#foreach"><b>4.6 &lt;foreach&gt;</b></a>, <a
href="#assign"><b>5.4 &lt;assign&gt;</b></a>, <a
href="#param"><b>5.8 &lt;param&gt;</b></a>, <a
href="#ConditionalExpressions"><b>5.10.1 Conditional
Expressions</b></a>, <a href="#LocationExpressions"><b>5.10.2
Location Expressions</b></a>, <a href="#ValueExpressions"><b>5.10.3
Legal Data Values and Value Expressions</b></a>, <a
href="#ErrorsinExpressions"><b>5.10.4 Errors in
Expressions</b></a>, <a href="#SystemVariables"><b>5.11 System
Variables</b></a>, <a href="#send"><b>6.2 &lt;send&gt;</b></a>, <a
href="#ecma_location_expressions"><b>D.2.3 Location
Expressions</b></a>, <a href="#ecma_assign"><b>D.2.5
&lt;assign&gt;</b></a>, <a href="#xpath_assign"><b>D.3.5
&lt;assign&gt;</b></a> </td>
</tr>

<tr>
<td align="center">error.platform</td>
<td>Indicates that a platform- or application-specific error has
occurred.</td>
<td><a href="#ErrorEvents"><b>3.12.2 Errors</b></a></td>
<td /></tr>
</tbody>
</table>
</div>
</div>

<div class="div2">
<h3><a id="SelectingTransitions" name="SelectingTransitions" />3.13
Selecting and Executing Transitions</h3>

<p>To simplify the following definitions, we introduce the event
NULL. NULL has no name and is used only in these definitions. It
nevers occurs in the event queues of an SCXML Processor. All other
events have names and are distinct from NULL. (In effect, NULL is a
pseudo-event that is used in these definitions as a trigger for
eventless transitions.)</p>

<p>[<a title="" id="transition-enabled"
name="transition-enabled">Definition</a>: A transition T is
<b>enabled</b> by named event E in atomic state S if a) T's source
state is S or an ancestor of S, b) T matches E's name (see <a
href="#EventDescriptors"><b>3.12.1 Event Descriptors</b></a>) c) T
lacks a 'cond' attribute or its 'cond' attribute evaluates to
"true". A transition is <b>enabled</b> by NULL in atomic state S if
a) T lacks an 'event' attribute b) T's source state is S or an
ancestor of S c) T lacks an 'cond' attribute or its 'cond'
attribute evaluates to "true". (Note that such a transition can
never be enabled by any named event.)]</p>

<p>[<a title="" id="optimally-enabled"
name="optimally-enabled">Definition</a>: A transition T is
<b>optimally enabled</b> by event E in atomic state S if a) T is
enabled by E in S and b) no transition that precedes T in document
order in T's source state is enabled by E in S and c) no transition
is enabled by E in S in any descendent of T's source state.]</p>

<p>[<a title="" id="optimal-transition-set"
name="optimal-transition-set">Definition</a>: The <b>optimal
transition set</b> enabled by event E in state configuration C is
the largest set of transitions such that each transition in the set
is optimally enabled by E in an atomic state in C and no transition
has a source state that is exited by another transition in the set
that proceeds it in document order. ]</p>

<p>[<a title="" id="source-state"
name="source-state">Definition</a>: The <b>source state</b> of a
transition is the &lt;state&gt; or &lt;parallel&gt; element that it
occurs in. The <b>target state(s)</b> of the transition is the
state or set of states specified by its 'target' attribute. The
<b>complete target set</b> of a transition consists of all the
states that will be active after the transition is taken. It
contains the target states of the transition plus all their
ancestors, expanded by the recursive application of the following
two operations: 1) if any &lt;parallel&gt; element is a member of
the set, any of its children that are not members of the set must
be added 2) if any compound &lt;state&gt; is in the set and none of
its children is in the set, its default initial state is added to
the set. Any state whose child(ren) are added to the complete
target set by clause 2 is called a <b>default entry state</b>.
]</p>

<p>[<a title="" id="exit-set" name="exit-set">Definition</a>: The
<b>exit set</b> of a transition is the set of states that are
exited when the transition is taken. If the transition does not
contain a 'target', its exit set is empty. Otherwise (i.e., if the
transition contains a 'target'), if it 'type' of "external", its
exit set consists of all active states that are proper descendents
of the <a href="#LCA">Least Common Ancestor (LCA)</a> of the source
and target states. Otherwise, if the transition has 'type'
"internal" and all its target states are proper descendents of its
source state, the target set consists of all active states that are
proper descendents of its source state. (If a transition has 'type'
of "internal", but its target states are not all proper descendents
of its source state, its exit set is defined as if it had 'type' of
"external". The exit set of a set of transitions is the union of
the exit sets of the individual transitions. ]</p>

<p>[<a title="" id="entry-set" name="entry-set">Definition</a>: The
<b>entry set</b> of a transition is the set of states that are
entered when the transition is taken. If a transition does not
contain a 'target', its entry set is empty. Otherwise, it consists
of all members of the transitions complete target set that are not
currently active. The entry set of a set of transitions is the
union of the transition sets of the individual transitions.]</p>

<p>[<a title="" id="microstep" name="microstep">Definition</a>: A
<b>microstep</b> consists of the execution of the transitions in an
optimal enabled transition set.]</p>

<p>[<a title="" id="macrostep" name="macrostep">Definition</a>: A
<b>macrostep</b> is a series of one or more microsteps ending in a
configuration where the internal event queue is empty and no
transitions are enabled by NULL. ]</p>

<p>To execute a microstep, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
the transitions in the corresponding optimal enabled transition To
execute a set of transitions, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> first
exit all the states in the transitions' exit set in <a
href="#exitOrder">exit order</a>. It <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> then
execute the executable content contained in the transitions in
document order. It <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> then enter the states in the transitions'
entry set in <a href="#entryOrder">entry order</a>.</p>

<p>To exit a state, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
the executable content in the state's &lt;onexit&gt; handler. Then
it <em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
cancel any ongoing invocations that were triggered by that state.
Finally, the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> remove the state from the active state's
list.</p>

<p>To enter a state, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> add the
state to the active state's list. Then it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
the executable content in the state's &lt;onentry&gt; handler. If
the state is a default entry state and has an &lt;initial&gt;
child, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> then execute the executable content in
the &lt;initial&gt; child's &lt;transition&gt;.</p>

<p>At startup, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
state machine in the configuration specified by the 'initial'
attribute of the &lt;scxml&gt; element.</p>

<p>After entering the initial configuration, and after executing
each microstep, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> check the
state configuration for &lt;final&gt; states that it has entered
during the microstep. If it has entered a &lt;final&gt; state that
is a child of &lt;scxml&gt;, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> halt processing. If it has entered a
&lt;final&gt; state that is a child of a compound state, it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> generate
the event done.state.<em>id</em>, where <em>id</em> is the id of
the compound state. If the compound state is itself the child of a
&lt;parallel&gt; element, and all the &lt;parallel&gt; element's
other children are in final states, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> generate
the event done.state.<em>id</em>, where <em>id</em> is the id of
the &lt;parallel&gt; elements.</p>

<p>After checking the state configuration, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> select
the optimal transition set enabled by NULL in the current
configuration. If the set is not empty, it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
it as a microstep. If the set is empty, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> remove
events from the internal event queue until the queue is empty or it
finds an event that enables a non-empty optimal transition set in
the current configuration. If it finds such a set, the processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> then
execute it as a microstep. (Otherwise the internal event queue is
empty and the Processor has completed a macrostep.)</p>

<p>After completing a macrostep, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
in document order the &lt;invoke&gt; handlers in all states that
have been entered since the completion of the last macrostep. Then
the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> remove events from the external event
queue, waiting till events appear if necessary, until it finds one
that enables a non-empty optimal transition set in the current
configuration. The Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> then execute that set as a microstep.</p>

<p>See <a href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm
for SCXML Interpretation</b></a> for more details.</p>
</div>

<div class="div2">
<h3><a id="IDs" name="IDs" />3.14 IDs</h3>

<p>In a conformant SCXML document, the values of all attributes of
type "id" <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> be unique within the session. When such
an attribute is defined to be optional and the author omits it, the
SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> generate a unique one automatically at
document load time. (Note that Such system generated IDs cannot
normally be referenced elsewhere in the document because they are
not known to the author. In particular, a state with a system
generated ID cannot be the target of a transition.) The ids for
&lt;send&gt; and &lt;invoke&gt; are subtly different. In a
conformant SCXML document, they <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> be unique within the session, but in the
case where the author does not provide them, the processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> generate
a new unique ID not at load time but <em>each time the element is
executed</em>. Furthermore the attribute 'idlocation' can be used
to capture this automatically generated id. Finally note that the
automatically generated id for &lt;invoke&gt; has a special format.
See <a href="#invokeattrs"><b>6.4.1 Attribute Details</b></a> for
details. The SCXML processor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> generate all other ids in any format, as
long as they are unique.</p>
</div>
</div>

<div class="div1">
<h2><a id="executable" name="executable" />4 Executable
Content</h2>

<div class="div2">
<h3><a id="ExecutableIntroduction"
name="ExecutableIntroduction" />4.1 Introduction</h3>

<p>[This section is informative.]</p>

<p>Executable content allows the state machine to <em>do</em>
things. It provides the hooks that allow an SCXML session to modify
its data model and interact with external entities. Executable
content consists of actions that are performed as part of taking
transitions. In particular, executable content occurs inside
&lt;onentry&gt; and &lt;onexit&gt; elements as well as inside
transitions. When the state machine takes a transition, it executes
the &lt;onexit&gt; executable content in the states it is leaving,
followed by the content in the transition, followed by the
&lt;onentry&gt; content in the states it is entering. See <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details.</p>

<p>This standard defines elements of executable content which can
raise events<a href="#raise"><b>4.2 &lt;raise&gt;</b></a>,
communicate with external entities <a href="#send"><b>6.2
&lt;send&gt;</b></a>, log information <a href="#log"><b>4.7
&lt;log&gt;</b></a> execute scripts <a href="#script"><b>5.9
&lt;script&gt;</b></a> and modify the data model <a
href="#assign"><b>5.4 &lt;assign&gt;</b></a>, as well as control
constructs to conditionalize execution <a href="#if"><b>4.3
&lt;if&gt;</b></a> and to iterate over the items in a collection <a
href="#foreach"><b>4.6 &lt;foreach&gt;</b></a>. In addition, SCXML
implementations are allowed to define their own, platform-specific
executable content (see <a href="#extensibility"><b>4.10
Extensibility of Executable Content</b></a>).</p>
</div>

<div class="div2">
<h3><a id="raise" name="raise" />4.2 &lt;raise&gt;</h3>

<p>The &lt;raise&gt; element raises an event in the current SCXML
session. Note that the event will not be processed until the
current block of executable content has completed and all events
that are already in the internal event queue have been processed.
For example, suppose the &lt;raise&gt; element occurs first in the
&lt;onentry&gt; handler of state S followed by executable content
elements ec1 and ec2. If event e1 is already in the internal event
queue when S is entered, the event generated by &lt;raise&gt; will
not be processed until ec1 and ec2 have finished execution and e1
has been processed. For details of event processing, see <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a>. Note that the <a href="#send"><b>6.2
&lt;send&gt;</b></a> element may also be used to raise internal
events in an SCXML session. The &lt;send&gt; is a general-purpose
message element, while &lt;raise&gt; has a simpler syntax.</p>

<div class="div3">
<h4><a id="N1077E" name="N1077E" />4.2.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>event</td>
<td>true</td>
<td />
<td>NMTOKEN</td>
<td>none</td>
<td></td>
<td>Specifies the name of the event. This will be matched against
the 'event' attribute of transitions.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N107A4" name="N107A4" />4.2.2 Children</h4>

None.</div>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the event that is generated at the
rear of the session's internal event queue.</p>
</div>

<div class="div2">
<h3><a id="if" name="if" />4.3 &lt;if&gt;</h3>

<p>&lt;if&gt; is a container for conditionally executed
elements.</p>

<div class="div3">
<h4><a id="N107B3" name="N107B3" />4.3.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>cond</td>
<td>true</td>
<td />
<td>Conditional expression</td>
<td>none</td>
<td>A valid conditional expression</td>
<td>A boolean expression. See <a
href="#ConditionalExpressions"><b>5.10.1 Conditional
Expressions</b></a> for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N107DC" name="N107DC" />4.3.2 Children</h4>

<ul>
<li>&lt;elseif&gt; Occurs 0 or more times. See <a
href="#elseif"><b>4.4 &lt;elseif&gt;</b></a></li>

<li>&lt;else&gt; Occurs 0 or 1 times. See <a href="#else"><b>4.5
&lt;else&gt;</b></a></li>

<li>The other children of &lt;if&gt; consist of executable content.
Note that since &lt;if&gt; itself is executable content, nested
&lt;if&gt; statements are allowed.</li>
</ul>
</div>

<p>The behavior of &lt;if&gt; is defined in terms of partitions of
executable content. The first partition consists of the executable
content between the &lt;if&gt; and the first &lt;elseif&gt;,
&lt;else&gt; or &lt;/if&gt; tag. Each &lt;elseif&gt; tag defines a
partition that extends from it to the next &lt;elseif&gt;,
&lt;else&gt; or &lt;/if&gt; tag. The &lt;else&gt; tag defines a
partition that extends from it to the closing &lt;/if&gt; tag. In a
conformant SCXML document, a partition <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> be empty.
In a conformant SCXML document, &lt;else&gt; <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> occur
after all &lt;elseif&gt; tags.</p>

<p>When the &lt;if&gt; element is executed, the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
the first partition in document order that is defined by a tag
whose 'cond' attribute evaluates to true, if there is one.
Otherwise, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> execute the partition defined by the
&lt;else&gt; tag, if there is one. Otherwise it <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
execute any of the executable content.</p>

<p>Here is an example:</p>

<div class="exampleInner">
<pre>
&lt;if cond="cond1"&gt;
  &lt;!-- selected when "cond1" is true --&gt;
&lt;elseif cond="cond2"/&gt;
  &lt;!-- selected when "cond1" is false and "cond2" is true --&gt;
&lt;elseif cond="cond3"/&gt;
  &lt;!-- selected when "cond1" and "cond2" are false and "cond3" is true --&gt;
&lt;else/&gt;
  &lt;!-- selected when "cond1", "cond2", and "cond3" are false --&gt;
&lt;/if&gt;
           
</pre>
</div>
</div>

<div class="div2">
<h3><a id="elseif" name="elseif" />4.4 &lt;elseif&gt;</h3>

<div class="div3">
<h4><a id="N10809" name="N10809" />4.4.1 Overview</h4>

<p>&lt;elseif&gt; is an empty element that partitions the content
of an &lt;if&gt;, and provides a condition that determines whether
the partition is executed.</p>
</div>

<div class="div3" /></div>

<div class="div2">
<h3><a id="else" name="else" />4.5 &lt;else&gt;</h3>

<div class="div3">
<h4><a id="N10813" name="N10813" />4.5.1 Overview</h4>

<p>&lt;else&gt; is an empty element that partitions the content of
an &lt;if&gt;. It is equivalent to an &lt;elseif&gt; with a "cond"
that always evaluates to true.</p>
</div>

<div class="div3">
<h4><a id="N10818" name="N10818" />4.5.2 Attribute Details</h4>

<p>None.</p>
</div>
</div>

<div class="div2">
<h3><a id="foreach" name="foreach" />4.6 &lt;foreach&gt;</h3>

<div class="div3">
<h4><a id="N10821" name="N10821" />4.6.1 Overview</h4>

<p>The &lt;foreach&gt; element allows an SCXML application to
iterate through a collection in the data model and to execute the
actions contained within it for each item in the collection.</p>
</div>

<div class="div3">
<h4><a id="N10826" name="N10826" />4.6.2 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>array</td>
<td>true</td>
<td />
<td>Value expression</td>
<td>none</td>
<td>A value expression that evaluates to an iterable
collection.</td>
<td>The &lt;foreach&gt; element will iterate over a shallow copy of
this collection.</td>
</tr>

<tr>
<td>item</td>
<td>true</td>
<td />
<td>xsd:string</td>
<td>none</td>
<td>Any variable name that is valid in the specified data
model.</td>
<td>A variable that stores a different item of the collection in
each iteration of the loop.</td>
</tr>

<tr>
<td>index</td>
<td>false</td>
<td />
<td>xsd:string</td>
<td>none</td>
<td>Any variable name that is valid in the specified data
model.</td>
<td>A variable that stores the current iteration index upon each
iteration of the foreach loop.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10868" name="N10868" />4.6.3 Children</h4>

<p>The children of &lt;foreach&gt; consist of one or more items of
executable content. (Note that they are considered to be part of
the same block of executable content as the parent &lt;foreach&gt;
element.)</p>
</div>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> declare a new variable if the one
specified by 'item' is not already defined. If 'index' is present,
the SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> declare a new variable if the one
specified by 'index' is not already defined. If 'array' does not
evaluate to a legal iterable collection, or if 'item' does not
specify a legal variable name, the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> terminate
execution of the &lt;foreach&gt; element and the block that
contains it, and place the error error.execution on the internal
event queue.</p>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> start with the first item in the
collection and proceed to the last item in the iteration order that
is defined for the collection. (This order depends on the data
model in use. ) For each item, the processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> act as if
it has made a shallow copy or reference and assign it to the item
variable. (Note that the assigned value <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> be null or
undefined if the collection contains a null or undefined item.)
After making the assignment, the SCXML processor <em
title=" MUST in RFC2119 context" class="RFC2119">MUST</em> evaluate
its child executable content. It <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> then
proceed to the next item in iteration order. If the evaluation of
any child element causes an error, the processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> cease
execution of the &lt;foreach&gt; element and the block that
contains it. (Note that SCXML does not provide break functionality
to interrupt &lt;foreach&gt;, however targetless and/or eventless
transitions can provide sophisticated iterative behavior within the
SCXML application itself.)</p>
</div>

<div class="div2">
<h3><a id="log" name="log" />4.7 &lt;log&gt;</h3>

<div class="div3">
<h4><a id="N10890" name="N10890" />4.7.1 Overview</h4>

<p>&lt;log&gt; allows an application to generate a logging or debug
message.</p>
</div>

<div class="div3">
<h4><a id="N10895" name="N10895" />4.7.2 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>label</td>
<td>false</td>
<td />
<td>string</td>
<td>empty string</td>
<td />
<td>A character string with an implementation-dependent
interpretation.</td>
</tr>

<tr>
<td>expr</td>
<td>true</td>
<td />
<td>Value expression</td>
<td>none</td>
<td />
<td>An expression returning the value to be logged. See <a
href="#ValueExpressions"><b>5.10.3 Legal Data Values and Value
Expressions</b></a> for details. The nature of the logging
mechanism is implementation-dependent. For example, the SCXML
processor may convert this value to a convenient format before
logging it.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N108CA" name="N108CA" />4.7.3 Children</h4>

<p>None.</p>
</div>

<p>The manner in which the message is displayed or logged is
platform-dependent. The SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> insure
that &lt;log&gt; has no side-effects on document
interpretation.</p>
</div>

<div class="div2">
<h3><a id="profile-dependentexecutablecontent"
name="profile-dependentexecutablecontent" />4.8 Other Executable
Content</h3>

<p>The following elements of executable content are defined
elsewhere in this specification. They <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> occur
wherever executable content is allowed and <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
occur anyplace else.</p>

<ul>
<li>&lt;assign&gt;. Changes the value of a location in the data
model. See <a href="#assign"><b>5.4 &lt;assign&gt;</b></a> for
details.</li>

<li>&lt;validate&gt;. Validates the data model. See <a
href="#validate"><b>5.5 &lt;validate&gt;</b></a> for details.</li>

<li>&lt;script&gt;. Provides scripting capabilties. See <a
href="#script"><b>5.9 &lt;script&gt;</b></a> for details.</li>

<li>&lt;send&gt;. Sends an event to a specified destination. See <a
href="#send"><b>6.2 &lt;send&gt;</b></a> for details.</li>

<li>&lt;cancel&gt;. Cancels an event that was to be sent See <a
href="#cancel"><b>6.3 &lt;cancel&gt;</b></a> for details.</li>
</ul>
</div>

<div class="div2">
<h3><a id="EvaluationofExecutableContent"
name="EvaluationofExecutableContent" />4.9 Evaluation of Executable
Content</h3>

<p>Wherever executable content is permitted, an arbitrary number of
elements <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> occur. Such a sequence of elements of
executable content is called a block. For example, if transition t
takes the state machine from atomic state S1 to atomic state S2,
there are three blocks of executable content executed: the one in
the &lt;onexit&gt; handler of S1, the one inside t, and the one
inside the &lt;onentry&gt; handler of S2. The SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
the elements of a block in document order. If the processing of an
element causes an error to be raised, the processor <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
process the remaining elements of the block. (The execution of
other blocks of executable content is not affected.)</p>

<p>Events raised during the processing of executable content are
treated like any other events. Note in particular, that error
events will not be removed from the queue and processed until all
events preceding them in the queue have been processed. See <a
href="#ErrorEvents"><b>3.12.2 Errors</b></a> and <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details.</p>
</div>

<div class="div2">
<h3><a id="extensibility" name="extensibility" />4.10 Extensibility
of Executable Content</h3>

<p>Implementations <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> may provide additional executable content
corresponding to special features of their implementations. The
functionality of such platform-specific content is not restricted,
except that it <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> cause transitions or any form of
change of state (except indirectly, by raising events that trigger
transitions). Note that SCXML treats the executable content
triggered by a transition as a single blocking operation and that
no events are processed until all the executable content has
completed. For example, when taking a transition into state S, the
SCXML processor will not process any events or take any transitions
until all &lt;onentry&gt; handlers in S have finished. It is thus
important that all executable content, including platform-specific
extensions, execute swiftly.</p>

<p>In a conformant SCXML document any extensions to executable
content <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> be defined the 'scxml' namespace.
(Note that the schema <a href="#schemas"><b>B Schema</b></a> allows
elements from arbitrary namespaces inside blocks of executable
content.) The following example shows the incorporation of CCXML
functionality (see <a href="#CCXML">[W3C CCXML 1.0]</a>) into
SCXML. In particular an &lt;accept&gt; element in the 'ccxml'
namespace is invoked as executable content inside a transition.</p>

<div class="exampleInner">
<pre>
&lt;transition event="ccxml:connection.alerting"&gt;
  &lt;ccxml:accept connectionid="_event.data.connectionid"/&gt;
&lt;/transition&gt;
</pre>
</div>

<p>This markup is legal on any SCXML interpreter, but the behavior
of &lt;accept&gt; element is platform-dependent. See <a
href="#ConformingProcessors"><b>C.2 Conforming Processors</b></a>
for details.</p>

<p>A general method for implementing extensions using the
&lt;send&gt; element is presented in <a
href="#custom_action"><b>G.8 Custom Action Elements</b></a>.</p>
</div>
</div>

<div class="div1">
<h2><a id="data-module" name="data-module" />5 Data Model and Data
Manipulation</h2>

<div class="div2">
<h3><a id="DataModelIntroduction"
name="DataModelIntroduction" />5.1 Introduction</h3>

<p>[This section is informative.]</p>

<p>The Data Model offers the capability of storing, reading, and
modifying a set of data that is internal to the state machine. This
specification does not mandate any specific data model, but instead
defines a set of abstract capabilities that can be realized by
various languages, such as ECMAScript or XML/XPath. Implementations
may choose the set of data models that they support. In addition to
the underlying data structure, the data model defines a set of
expression as described in <a href="#Expressions"><b>5.10
Expressions</b></a>. These expressions are used to refer to
specific locations in the data model, to compute values to assign
to those locations, and to evaluate boolean conditions. Finally,
the data model includes a set of system variables, as defined in <a
href="#SystemVariables"><b>5.11 System Variables</b></a>, which are
automatically maintained by the SCXML processor.</p>

<p>The data model is defined via the <a href="#datamodel"><b>5.2
&lt;datamodel&gt;</b></a> element, which contains zero or more <a
href="#data"><b>5.3 &lt;data&gt;</b></a> elements, each of which
defines a single data element and assigns an initial value to it.
These values may be specified in-line or loaded from an external
source. They can then be updated via the <a href="#assign"><b>5.4
&lt;assign&gt;</b></a> element. The <a href="#validate"><b>5.5
&lt;validate&gt;</b></a> element can be used to validate the data
(in data models where that makes sense), while the <a
href="#donedata"><b>5.6 &lt;donedata&gt;</b></a>, <a
href="#content"><b>5.7 &lt;content&gt;</b></a> , and <a
href="#param"><b>5.8 &lt;param&gt;</b></a> elements can be used to
incorporate data into communications with external entities.
Finally, the <a href="#script"><b>5.9 &lt;script&gt;</b></a>
element permits the incorporation of a scripting language.</p>

<p>The interpretation of these elements depends on the datamodel in
question, and not all elements are supported in all datamodels. For
the details of specific data models, see <a href="#profiles"><b>D
Data Models</b></a>.</p>
</div>

<div class="div2">
<h3><a id="datamodel" name="datamodel" />5.2 &lt;datamodel&gt;</h3>

<p>&lt;datamodel&gt; is a wrapper element which encapsulates any
number of &lt;data&gt; elements, each of which defines a single
data object. The exact nature of the data object depends on the
data model language used.</p>

<div class="div3">
<h4><a id="N10972" name="N10972" />5.2.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>schema</td>
<td>false</td>
<td />
<td>URI</td>
<td>none</td>
<td>Location of the schema for this datamodel</td>
<td>URL of the schema for this datamodel. See <a
href="#validate"><b>5.5 &lt;validate&gt;</b></a> for its use. The
exact nature of the schema depends on the data model language being
used.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N1099B" name="N1099B" />5.2.2 Children</h4>

<ul>
<li>&lt;data&gt; Occurs 0 or more times. Each instance defines a
named data element.</li>
</ul>
</div>

<p>In a conformant SCXML document, the 'schema' attribute <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> occur on
the top-level &lt;datamodel&gt; elemen, namely the one that is a
child of &lt;scxml&gt;. It <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> occur on any other element.</p>
</div>

<div class="div2">
<h3><a id="data" name="data" />5.3 &lt;data&gt;</h3>

<p>The &lt;data&gt; element is used to declare and populate
portions of the datamodel.</p>

<div class="div3">
<h4><a id="N109B0" name="N109B0" />5.3.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>id</td>
<td>true</td>
<td />
<td>ID</td>
<td>none</td>
<td></td>
<td>The name of the data item. See <a href="#IDs"><b>3.14
IDs</b></a> for details.</td>
</tr>

<tr>
<td>src</td>
<td>false</td>
<td />
<td>URI</td>
<td>none</td>
<td />
<td>Gives the location from which the data object should be
fetched. See <a href="#ValueExpressions"><b>5.10.3 Legal Data
Values and Value Expressions</b></a> for details.</td>
</tr>

<tr>
<td>expr</td>
<td>false</td>
<td />
<td>Expression</td>
<td>none</td>
<td>Any valid value expression</td>
<td>Evaluates to provide the value of the data item. See <a
href="#ValueExpressions"><b>5.10.3 Legal Data Values and Value
Expressions</b></a> for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N109FA" name="N109FA" />5.3.2 Children</h4>

<p>The children of the &lt;data&gt; element represent an in-line
specification of the value of the data object.</p>

<p>In a conformant SCXML document, a &lt;data&gt; element <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> have either
a 'src' or an 'expr' attribute, but <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
have both. Furthermore, if either attribute is present, the element
<em title="MUST NOT in RFC2119 context" class="RFC2119">MUST
NOT</em> have any children. Thus 'src', 'expr' and children are
mutually exclusive in the &lt;data&gt; element.</p>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> must allow the environment to provide
values for top-level &lt;data&gt; elements (namely those that are
children of the &lt;datamodel &gt; element that is a child of
&lt;scxml&gt;). Specifically, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use the
values provided at instantiation time instead of those contained in
thee &lt;data&gt; elements. The manner in which the environment
specifies these values is platform-dependent.</p>

<p>If the value specified (by 'src', children, or the environment)
is not a legal data value, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> create an
empty data element in the data model with the specified id. Note
that what constitutes a legal data value depends on the data model
language used. See <a href="#profiles"><b>D Data Models</b></a> for
details.</p>
</div>

<div class="div3">
<h4><a id="DataBinding" name="DataBinding" />5.3.3 Data Binding and
Scoping</h4>

<p>There is a single globally visible data model for the entire
state machine. Specifically, the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> allow any
data element to be accessed from any state. Thus the data model has
no concept of scoping. However, authors control when the initial
values are assigned to the data elements by means of the 'binding'
attribute on the &lt;scxml&gt; element. When 'binding' is assigned
the value "early" (the default), the scxml processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> create
all data elements and assign their initial values at document
initialization time. When 'binding' is assigned the value "late",
the scxml processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> create the data elements at document
initialization time, but <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> assign the value specified by 'expr' to a
given data element only when the state that contains it is entered
for the first time, before any &lt;onentry&gt; markup. (The value
of the data element between the time it is created and the time its
parent state is first entered will depend on the data language
chosen. The value specified by 'expr' will be assigned to the data
element even if the element already has a non-null value when the
parent state is first entered.)</p>

<p>Ordering dependencies between &lt;data&gt; elements are not
permitted. In the case of early binding, the scxml processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> evaluate
all &lt;data&gt; elements at initialization time but <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> do so in
any order it chooses. Suppose, for example, that the declaration of
element "a" precedes the declaration of element "b" in a document.
It is not safe to assume that "a" will be instantiated and have a
value when the declaration of "b" is executed. Therefore the "expr"
in "b" cannot safely reference the value of "a" (and vice-versa).
When late binding is selected, the scxml processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> create
data model elements at initialization time but <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> do so in
any order it chooses. Similarly, the processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> assign
the value specified by 'expr' to data elements only when the state
containing them is first entered, but <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> do so in
any order it chooses.</p>

<p>Values created by &lt;data&gt; elements are local to their
session. In particular, the scxml processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> insure
that such values are changed only by the execution of executable
content or the &lt;finalize&gt; element. Note that in addition to
the author-controlled &lt;data&gt; elements there are system
variables whose values are maintained by the scxml processor. See
<a href="#SystemVariables"><b>5.11 System Variables</b></a> for
details.</p>
</div>
</div>

<div class="div2">
<h3><a id="assign" name="assign" />5.4 &lt;assign&gt;</h3>

<p>The &lt;assign&gt; element is used to modify the data model.</p>

<div class="div3">
<h4><a id="N10A4E" name="N10A4E" />5.4.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>location</td>
<td>true</td>
<td />
<td>path expression</td>
<td>none</td>
<td>Any valid location expression.</td>
<td>The location in the data model into which to insert the new
value. See <a href="#LocationExpressions"><b>5.10.2 Location
Expressions</b></a> for details.</td>
</tr>

<tr>
<td>expr</td>
<td>false</td>
<td>This attribute must not occur in an &lt;assign&gt; element that
has children.</td>
<td>value expression</td>
<td>none</td>
<td>Any valid value expression</td>
<td>An expression returning the value to be assigned. See <a
href="#ValueExpressions"><b>5.10.3 Legal Data Values and Value
Expressions</b></a> for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10A89" name="N10A89" />5.4.2 Children</h4>

<p>The children of the &lt;assign&gt;element provide an in-line
specification of legal data value (see <a
href="#ValueExpressions"><b>5.10.3 Legal Data Values and Value
Expressions</b></a>) to be inserted into the datamodel at the
specified location.</p>
</div>

<p>A conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> specify either "expr" or children of
&lt;assign&gt;, but not both.</p>

<p>Assignment to a data model is done by using a location
expression to denote the part of the data model where the insertion
is to be made. If the location expression does not denote a valid
location in the datamodel or if the value specified ( by 'expr' or
children) is not a legal value for the location specified, the
processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the error error.execution in the
internal event queue. Otherwise, the processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
specified value at the specified location. Note that the nature of
the insertion and the definition of a legal value depends on the
data model language used. Note also that datamodels <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> additional
attributes for &lt;assign&gt; beyond those specified here. See <a
href="#profiles"><b>D Data Models</b></a> for details.</p>
</div>

<div class="div2">
<h3><a id="validate" name="validate" />5.5 &lt;validate&gt;</h3>

<p>The &lt;validate&gt; element causes the datamodel to be
validated.</p>

<div class="div3">
<h4><a id="N10AAA" name="N10AAA" />5.5.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>location</td>
<td>false</td>
<td />
<td>location expression</td>
<td>none</td>
<td>Any valid location expression.</td>
<td>The location of the subtree to validate. If it is not present,
the entire datamodel is validated. See <a
href="#LocationExpressions"><b>5.10.2 Location Expressions</b></a>
for details.</td>
</tr>

<tr>
<td>schema</td>
<td>false</td>
<td />
<td>URI</td>
<td>none</td>
<td>Any valid URI</td>
<td>The location of the schema to use for validation. If this
attribute is not present, the schema specified in the top-level
&lt;datamodel&gt; is used.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10AE1" name="N10AE1" />5.5.2 Children</h4>

<p>None.</p>
</div>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> validate the datamodel only when
instructed to do so by the &lt;validate&gt; element. A valid SCXML
document containing the &lt;validate&gt; element <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> specify a
schema with the 'schema'attribute of the &lt;validate&gt; element
or with the 'schema' attribute of the &lt;datamodel&gt; element (or
with both). If the &lt;validate&gt; element specifies a schema, the
processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> use this schema to validate the
datamodel. Otherwise, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> use the value specified in the
&lt;datamodel&gt; element.</p>
</div>

<div class="div2">
<h3><a id="donedata" name="donedata" />5.6 &lt;donedata&gt;</h3>

<p>A wrapper element holding data to be returned when a
&lt;final&gt; state is entered.</p>

<div class="div3">
<h4><a id="N10AFA" name="N10AFA" />5.6.1 Attribute Details</h4>

<p>None.</p>
</div>

<div class="div3">
<h4><a id="N10AFF" name="N10AFF" />5.6.2 Children</h4>

<ul>
<li>&lt;content&gt;. Specifies in-line data to include in the
event. May occur 0 or 1 times. See <a href="#content"><b>5.7
&lt;content&gt;</b></a> .</li>

<li>&lt;param&gt; Extracts data from the data model to include in
the event. See <a href="#param"><b>5.8 &lt;param&gt;</b></a> for
details. May occur 0 or more times.</li>
</ul>
</div>

<p>A conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> specify either a single &lt;content&gt;
element or one or more &lt;param&gt; elements as children of
&lt;donedata&gt;, but not both. .</p>

<p>In cases where the SCXML processor generates a 'done' event upon
entry into the final state, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the data specified by this element
in the _event.data field, but exact format of that data will be
determined by the datamodel (see <a href="#profiles"><b>D Data
Models</b></a> for details). In other cases (namely when the
&lt;final&gt; element is a child of &lt;scxml&gt; and the state
machine has not been triggered by &lt;invoke&gt;), the SCXML
processor <em title="SHOULD in RFC2119 context"
class="RFC2119">SHOULD</em> return the data to the environment in
an implementation-dependent manner.</p>
</div>

<div class="div2">
<h3><a id="content" name="content" />5.7 &lt;content&gt;</h3>

<p>A container element holding in-line data to be passed to an
external service.</p>

<div class="div3">
<h4><a id="N10B25" name="N10B25" />5.7.1 Attribute Details</h4>

<p>None.</p>
</div>

<div class="div3">
<h4><a id="N10B2A" name="N10B2A" />5.7.2 Children</h4>

<p>In a conformant SCXML document, the child elements of
&lt;content&gt; contain arbitrary markup which <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> consist of
text, XML from any namespace, or a mixture of both. The use of this
markup depends on the context in which the &lt;content&gt; element
occurs. See <a href="#donedata"><b>5.6 &lt;donedata&gt;</b></a>, <a
href="#send"><b>6.2 &lt;send&gt;</b></a> and <a
href="#invoke"><b>6.4 &lt;invoke&gt;</b></a> for details. For the
use of namespaces inside &lt;content&gt;, see <a
href="#content_and_namespaces"><b>G.7 Inline Content and
Namespaces</b></a>.</p>
</div>
</div>

<div class="div2">
<h3><a id="param" name="param" />5.8 &lt;param&gt;</h3>

<p>The &lt;param&gt; tag provides a general way of identifying a
name/key and a dynamically calcuated value, which can be passed to
an external service or included in an event.</p>

<div class="div3">
<h4><a id="N10B44" name="N10B44" />5.8.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>name</td>
<td>true</td>
<td />
<td>NMTOKEN</td>
<td>none</td>
<td>A string literal</td>
<td>The name of the key.</td>
</tr>

<tr>
<td>expr</td>
<td>false</td>
<td>May not occur with 'location'</td>
<td>value expression</td>
<td>none</td>
<td>Valid value expression</td>
<td>A value expression (see <a href="#ValueExpressions"><b>5.10.3
Legal Data Values and Value Expressions</b></a>) that is evaluated
to provide the value.</td>
</tr>

<tr>
<td>location</td>
<td>false</td>
<td>May not occur with 'expr'</td>
<td>location expression</td>
<td>none</td>
<td>Valid location expression</td>
<td>A location expression (see <a
href="#LocationExpressions"><b>5.10.2 Location Expressions</b></a>)
that specifies the location in the datamodel to use as the
value.</td>
</tr>
</tbody>
</table>

<p>A conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> specify either the 'expr' attribute of
&lt;param&gt; or the 'location' attribute, but <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
specify both. If the 'location' attribute does not refer to a valid
location in the data model, or if the evaluation of the 'expr'
produces an error, the processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error error.execution on the internal event queue and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> ignore
the name and value. Otherwise the use of the name and value depends
on the context in which the &lt;param&gt; element occurs. See <a
href="#donedata"><b>5.6 &lt;donedata&gt;</b></a>, <a
href="#send"><b>6.2 &lt;send&gt;</b></a> and <a
href="#invoke"><b>6.4 &lt;invoke&gt;</b></a> for details.</p>
</div>

<div class="div3">
<h4><a id="N10BA5" name="N10BA5" />5.8.2 Children</h4>

<p>None.</p>
</div>
</div>

<div class="div2">
<h3><a id="script" name="script" />5.9 &lt;script&gt;</h3>

<p>The &lt;script&gt; element adds scripting capability to the
state machine.</p>

<div class="div3">
<h4><a id="N10BB0" name="N10BB0" />5.9.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>src</td>
<td>false</td>
<td>May not occur if the element has children.</td>
<td />
<td>none</td>
<td>A valid URI</td>
<td>Gives the location from which the script should be
downloaded.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10BD6" name="N10BD6" />5.9.2 Children</h4>

<p>The children of the &lt;script&gt; element represent the script
code to be executed.</p>
</div>

<p>A conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> specify either the 'src' attribute or
child content, but not both. If 'src' is specified, the SCXML
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> download the script from the specified
location at load time. If the script can not be downloaded within a
platform-specific timeout interval, the document is considered
non-conformant, and the platform <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> reject
it.</p>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate any &lt;script&gt; element that
is a child of &lt;scxml&gt; at document load time. It <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> evaluate
all other &lt;script&gt; elements as part of normal executable
content evaluation.</p>

<p>In a conformant SCXML document, the name of any script variable
<em title="MAY in RFC2119 context" class="RFC2119">MAY</em> be used
as a location expression (see <a
href="#LocationExpressions"><b>5.10.2 Location
Expressions</b></a>).</p>

<p>For an example of a data model incorporating scripting, see <a
href="#ecma-profile"><b>D.2 The ECMAScript Data Model</b></a>.</p>
</div>

<div class="div2">
<h3><a id="Expressions" name="Expressions" />5.10 Expressions</h3>

<p>SCXML contains three types of expressions, as described below.
Different datamodels will support different languages for these
expression types, but certain properties of the expressions are
constant across languages and are defined here.</p>

<p>The SCXML processor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> optimize expression evaluation. Thus the
SCXML processor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> not evaluate expressions as often as
indicated in <a href="#AlgorithmforSCXMLInterpretation"><b>A
Algorithm for SCXML Interpretation</b></a> or at the same points in
the algorithm.</p>

<p>When "late" data binding is used, accessing data substructure in
expressions before the corresponding &lt;data&gt; element is loaded
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> yield
the same execution-time behavior as accessing non-existent data
substructure in a loaded &lt;data&gt; instance. Such behavior is
defined by the data expression language in use.</p>

<div class="div3">
<h4><a id="ConditionalExpressions"
name="ConditionalExpressions" />5.10.1 Conditional Expressions</h4>

<p>Conditional expressions are used inside the 'cond' attribute of
&lt;transition&gt;, &lt;if&gt; and &lt;elseif&gt;. The SCXML
processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> insure that boolean expressions do not
contain side effects that would effect the datamodel or the
execution of the state machine. If a conditional expression cannot
be evaluated as a boolean value ('true' or 'false') or if its
evaluation causes an error, the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> treat the
expression as if it evaluated to 'false' and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error 'error.execution' in the internal event queue. The set of
operators in conditional expressions varies depending on the
datamodel, but all datamodels <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> support the 'In()' predicate, which takes
a stateID as its argument and returns true if the state machine is
in that state. This predicate allows coordination among parallel
regions.</p>
</div>

<div class="div3">
<h4><a id="LocationExpressions" name="LocationExpressions" />5.10.2
Location Expressions</h4>

<p>Location expressions are used to specify a location in the
datamodel as part of the &lt;assign&gt;element. The exact nature of
a location depends on the datamodel. For example, in the XPath
datamodel (<a href="#xpath-profile"><b>D.3 The XPath Data
Model</b></a>), the underlying data structure is an XML tree and
the set of valid locations consists of the existing nodes and
nodesets in the tree. If a location expression cannot be evaluated
to yield a valid location, the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error error.execution in the internal event queue.</p>
</div>

<div class="div3">
<h4><a id="ValueExpressions" name="ValueExpressions" />5.10.3 Legal
Data Values and Value Expressions</h4>

<p>A data model definition contains a specification of the
underlying data structure. For example, the XPath datamodel (<a
href="#xpath-profile"><b>D.3 The XPath Data Model</b></a>) defines
the data structure to be an XML tree. Such a specification of the
data structure implicitly defines a set of "legal data values",
namely the objects that can be part of such a data structure. For
an XML data model, the set of legal data values consists of XML
trees and subtrees, plus strings (as values of attributes or text
children). In conjunction with this, the datamodel definition
specifies a set of value expressions which can be evaluated at
runtime to return legal data values. If a value expression does not
return a legal data value, the SCXML processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error error.execution in the internal event queue.</p>
</div>

<div class="div3">
<h4><a id="ErrorsinExpressions" name="ErrorsinExpressions" />5.10.4
Errors in Expressions</h4>

<p>The SCXML processor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> reject documents containing syntactically
ill-formed expressions at document load time, or it <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> wait and
place error.execution in the internal event queue at runtime when
the expressions are evaluated. If the processor waits until it
evaluates the expressions at runtime to raise errors, it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> raise
errors caused by expressions returning illegal values at the points
at which <a href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm
for SCXML Interpretation</b></a> indicates that the expressions are
to be evaluated. Note that this requirement holds even if the
implementation is optimizing expression evaluation.</p>
</div>
</div>

<div class="div2">
<h3><a id="SystemVariables" name="SystemVariables" />5.11 System
Variables</h3>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> maintain a protected portion of the data
model containing information that can be useful to applications. We
refer to the items in this special part of the data model as
'system variables'. Implementations <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> provide
the following system variables, and <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> support
others.</p>

<ul>
<li><em>_event</em>. The SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use the
variable '_event' to hold a structure containing the current
event's name and any data contained in the event (see <a
href="#InternalStructureofEvents"><b>5.11.1 The Internal Structure
of Events</b></a>. The exact nature of the structure depends on the
datamodel being used. See <a href="#profiles"><b>D Data
Models</b></a> for details. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> bind the
_event variable when an event is pulled off the internal or
external event queue to be processed, and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> keep the
variable bound to that event until another event is processed. (It
follows that when an application is testing the 'cond' attribute of
a &lt;transition&gt; element that contains an 'event' attribute,
_event will be bound to the event that the transition is being
matched against. If the transition is selected to be executed,
_event will remain bound to that event in the &lt;onexit&gt;
handlers of the states being exited, the executable content of the
transition itself, and the &lt;onentry&gt; handlers of the states
being entered. In the case of &lt;transition&gt; elements that do
not contain an 'event' attribute and the &lt;onexit&gt; and
&lt;onentry&gt; handlers of any states that are exited or entered
by such transitions, the _event variable will not have a
predictable value since the transition is not being driven by an
event. In these cases, _event will be bound to the last event that
was matched against a transition.) The SCXML Processor <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
bind _event at initialization time until the first event is
processed. Hence _event is unbound when the state machine starts
up. See <a href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm
for SCXML Interpretation</b></a> for details. If the data in the
event is not a legal instance of the data model language, and the
Processor cannot translate it into one, then the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error error.execution in the internal event queue at the point at
which it attempts to bind _event. In this case, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> leave the
event data part of the _event structure unbound. (Note that the
event's name will still be available, however and that processing
of both the original event and the error event will proceed as
usual.)</li>

<li><em>_sessionid</em>. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> bind the
variable _sessionid at load time to the system-generated id for the
current SCXML session. (This is of of type NMTOKEN.) The Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> keep
the variable bound to this value until the session terminates.</li>

<li><em>_name</em>. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> bind the
variable _name at load time to the value of the 'name' attribute of
the &lt;scxml&gt; element. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> keep the
variable bound to this value until the session terminates.</li>

<li><em>_ioprocessors</em>. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> bind the
variable _ioprocessors to a set of values, one for each Event I/O
Processor that it supports. The value associated with each I/O
Processor gives an address that external entities can use to
communicate with this SCXML session using that Event I/O Processor.
The underlying data structure and the syntax to access it depend on
the data model. See <a href="#profiles"><b>D Data Models</b></a>
for details. The nature of the values associated with the
individual Event I/O Processors depends on the Event I/O Processor
in question. See <a href="#eventioprocessors"><b>E Event I/O
Processors</b></a> for details. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> keep the
variable bound to this set of values until the session
terminates.</li>

<li><em>_x</em>. The variable _x is the root element for
platform-specific system variables. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place all
platform-specific system variables underneath it. The exact
structure of the platform-specific variables depends on the data
model. For example, in the ECMAScript datamodel <a
href="#ecma-profile"><b>D.2 The ECMAScript Data Model</b></a>, '_x'
will be a top-level ECMAScript object and the platform-specific
system variables will be its properties.</li>
</ul>

<p>The set of system variables may be expanded in future versions
of this specification. Variable names beginning with '_' are
reserved for system use. A conformant SCXML document <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
contain ids beginning with '_' in the &lt;data&gt; element.
Platforms <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place all platform-specific system
variables under the '_x' root.</p>

<p>The concrete realization of these variables in a specific data
model depends on the language used. For the exact location of these
variables in an XML data model, see <a href="#xpath-profile"><b>D.3
The XPath Data Model</b></a>. The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> cause any
attempt to change the value of a system variable to fail and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error error.execution on the internal event queue when such an
attempt is made.</p>

<div class="div3">
<h4><a id="InternalStructureofEvents"
name="InternalStructureofEvents" />5.11.1 The Internal Structure of
Events</h4>

<p>Events have an internal structure which is reflected in the
_event variable. This variable can be accessed to condition
transitions (via boolean expressions in the 'cond' attribute) or to
update the datamodel (via &lt;assign&gt;), etc.</p>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> insure that the following fields are
present in all events, whether internal or external.</p>

<ul>
<li><em>name</em>. This is a character string giving the name of
the event. It is what is matched against the 'event' attribute of
&lt;transition&gt;. Note that transitions can do additional tests
by using the value of this field inside boolean expressions in the
'cond' attribute.</li>

<li><em>type</em>. This field describes the event type. The SCXML
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> set it to: "platform" (for events raised
by the platform itself, such as error events), "internal" (for
events raised by &lt;raise&gt; and &lt;send&gt; with target
'_internal') or "external" (for all other events).</li>

<li><em>sendid</em>. In the case of error events triggered by a
failed attempt to send an event, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> set this
field to the send id of the triggering &lt;send&gt; element.
Otherwise it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> leave it blank.</li>

<li><em>origin</em>. This a URI, equivalent to the 'target'
attribute on the &lt;send&gt; element. If this event was received
from an external entity, the SCXML Processor <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em> set
this field to a value which, in combination with the "origintype"
field, will allow the receiver of the event to &lt;send&gt; a
response back to the originating entity. Otherwise, the Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> leave
this field blank.</li>

<li><em>origintype</em>. If this event was received from an
external entity, the SCXML Processor <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em> set
this field to a value which, in combination with the 'origin'
field, will allow the receiver of the event to &lt;send&gt; a
response back to the originating entity. Otherwise, the Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> leave
this field blank.</li>

<li><em>invokeid</em>. If this event is generated from an invoked
child process, the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> set this field to the invoke id of the
invocation that triggered the child process. Otherwise it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> leave it
blank.</li>

<li><em>data</em>. This field contains whatever data the sending
entity chose to include in this event. The receiving SCXML
Processor <em title="SHOULD in RFC2119 context"
class="RFC2119">SHOULD</em> reformat this data to match its data
model, but <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> otherwise modify it. If the
conversion is not possible, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> leave the
field blank and <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> place an error in the internal event
queue.</li>
</ul>
</div>
</div>
</div>

<div class="div1">
<h2><a id="external-module" name="external-module" />6 External
Communications</h2>

<div class="div2">
<h3><a id="ExternalIntroduction" name="ExternalIntroduction" />6.1
Introduction</h3>

<p>[This section is informative.]</p>

<p>The External Communications capability allows an SCXML session
to send and receive events from external entities, and to invoke
external services. <a href="#send"><b>6.2 &lt;send&gt;</b></a>
provides "fire and forget" capability to deliver events and data to
any destination, including other SCXML sessions. The 'delay'
attribute allows for deferred event delivery and can be used to
implement a timer. The details of event transport as well as the
format of the event and data are determined by the Event I/O
Processor selected. Each implementation will support one or more
such processor, and the author of the SCXML markup can choose the
one that is appropriate for the type of endpoint he is trying to
reach.</p>

<p><a href="#invoke"><b>6.4 &lt;invoke&gt;</b></a> offers a more
tightly coupled form of communication, specifically the ability to
trigger a platform-defined service and pass data to it. It and its
child &lt;finalize&gt; are useful in states that model the behavior
of an external service. The &lt;invoke&gt; element is executed
after the state's &lt;onentry&gt; element and causes an instance of
the external service to be created. The &lt;param&gt; and
&lt;content&gt; elements and the 'namelist' attribute can be used
to pass data to the service. Any events that are received by the
state machine from the invoked component during the invocation are
preprocessed by the &lt;finalize&gt; handler <em>before</em>
transitions are selected. The &lt;finalize&gt; code is used to
normalize the form of the returned data and to update the data
model before the transitions' "event" and "cond" clauses are
evaluated.</p>

<p>When parallel states invoke the same external service
concurrently, separate instances of the external service will be
started. They can be distinguished by ids which are associated with
them. Similarly, the ids contained in the events returned from the
external services can be used to determine which events are
responses to which invocation. Each event that is returned will be
processed only by the &lt;finalize&gt; in the state that invoked
it, but that event is then processed like any other event that the
state machine receives. The finalize code can thus be thought of as
a preprocessing stage that applies before the event is added to the
event queue. Note that the event will be passed to all parallel
states to check for transitions.</p>

<p>Since an invocation will be canceled when the state machine
leaves the invoking state, it does not make sense to start an
invocation in a state that will be exited immediately. Therefore
the &lt;invoke&gt; element is executed upon entry into the state,
but only <em>after</em> checking for eventless transitions and
transitions driven by pending internal events. If any such enabled
transition is found , it is taken and the state is exited
immediately, without triggering the invocation. Thus invocations
are triggered only when the state machine has reached a stable
configuration, i.e., one that it will be staying in while it waits
for external events. (See <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details.)</p>
</div>

<div class="div2">
<h3><a id="send" name="send" />6.2 &lt;send&gt;</h3>

<div class="div3">
<h4><a id="N10D38" name="N10D38" />6.2.1 Overview</h4>

<p>&lt;send&gt; is used to send events and data to external
systems, including external SCXML Interpreters, or to raise events
in the current SCXML session.</p>
</div>

<div class="div3">
<h4><a id="N10D3D" name="N10D3D" />6.2.2 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>event</td>
<td>false</td>
<td>Must not occur with 'eventexpr'. If the type is 'scxml', either
this attribute or 'eventexpr' must be present.</td>
<td>EventType.datatype</td>
<td>none</td>
<td></td>
<td>A string indicating the name of message being generated. See <a
href="#schemas"><b>B Schema</b></a> for details on the data
type.</td>
</tr>

<tr>
<td>eventexpr</td>
<td>false</td>
<td>Must not occur with 'event'. If the type is 'scxml', either
this attribute or 'event' must be present.</td>
<td>Value expression</td>
<td>none</td>
<td></td>
<td>A dynamic alternative to 'event'. If this attribute is present,
the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate it when the parent &lt;send&gt;
element is evaluated and treat the result as if it had been entered
as the value of 'event'.</td>
</tr>

<tr>
<td>target</td>
<td>false</td>
<td>Must not occur with 'targetexpr'</td>
<td>URI</td>
<td>none</td>
<td>A valid target URI</td>
<td>The unique identifier of the message target that the platform
should send the event to. See <a href="#SendTargets"><b>6.2.4 The
Target of Send</b></a> for details.</td>
</tr>

<tr>
<td>targetexpr</td>
<td>false</td>
<td>Must not occur with 'target'</td>
<td>Value expression</td>
<td>none</td>
<td>An expression evaluating to a valid target URI</td>
<td>A dynamic alternative to 'target'. If this attribute is
present, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate it when the parent &lt;send&gt;
element is evaluated and treat the result as if it had been entered
as the value of 'target'.</td>
</tr>

<tr>
<td>type</td>
<td>false</td>
<td>Must not occur with 'typeexpr'</td>
<td>string</td>
<td>none</td>
<td></td>
<td>A token that specifies the transport mechanism for the message.
See <a href="#SendTypes"><b>6.2.5 The Type of Send</b></a> for
details.</td>
</tr>

<tr>
<td>typeexpr</td>
<td>false</td>
<td>Must not occur with 'type'</td>
<td>value expression</td>
<td>none</td>
<td></td>
<td>A dynamic alternative to 'type'. If this attribute is present,
the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate it when the parent &lt;send&gt;
element is evaluated and treat the result as if it had been entered
as the value of 'type'.</td>
</tr>

<tr>
<td>id</td>
<td>false</td>
<td>Must not occur with 'idlocation'.</td>
<td>xml:ID</td>
<td>none</td>
<td>Any valid token</td>
<td>A string literal to be used as the identifier for this instance
of &lt;send&gt;. See <a href="#IDs"><b>3.14 IDs</b></a> for
details.</td>
</tr>

<tr>
<td>idlocation</td>
<td>false</td>
<td>Must not occur with 'id'.</td>
<td>Location expression</td>
<td>none</td>
<td>Any valid location expression</td>
<td>Any location expression evaluating to a data model location in
which a system-generated id can be stored. See below for details.
for details.</td>
</tr>

<tr>
<td>delay</td>
<td>false</td>
<td>Must not occur with 'delayexpr' or when the attribute 'target'
has the value "_internal".</td>
<td>Duration.datatype</td>
<td>None</td>
<td>A time designation as defined in CSS2 <a
href="#CSS2">[CSS2]</a> format</td>
<td>Indicates how long the processor should wait before dispatching
the message. See <a href="#schemas"><b>B Schema</b></a> for details
on the data type.</td>
</tr>

<tr>
<td>delayexpr</td>
<td>false</td>
<td>Must not occur with 'delay' or when the attribute 'target' has
the value "_internal".</td>
<td>Value expression</td>
<td>None</td>
<td>A value expression which returns a time designation as defined
in CSS2 <a href="#CSS2">[CSS2]</a> format</td>
<td>A dynamic alternative to 'delay'. If this attribute is present,
the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate it when the parent &lt;send&gt;
element is evaluated and treat the result as if it had been entered
as the value of 'delay'.</td>
</tr>

<tr>
<td>namelist</td>
<td>false</td>
<td>Must not be specified in conjunction with the &lt;content&gt;
element.</td>
<td>List of location expressions</td>
<td>none</td>
<td>List of data model locations</td>
<td>A space-separated list of one or more data model locations to
be included with the message. See <a
href="#LocationExpressions"><b>5.10.2 Location Expressions</b></a>
for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N10E1E" name="N10E1E" />6.2.3 Children</h4>

<ul>
<li>&lt;param&gt;. The SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> evaluate
this element when the parent &lt;send&gt; element is evaluated and
pass the resulting data unmodified to the external service when the
message is delivered. Occurs 0 or more times. See <a
href="#param"><b>5.8 &lt;param&gt;</b></a> for details. If
&lt;param&gt; and 'namelist' both occur, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
values generated by &lt;param&gt; after those in the 'namelist'. If
any &lt;param&gt; item has the same name as a 'namelist' item, the
SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> include both.</li>

<li>&lt;content&gt;. The SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> extract
the children of this element when the parent &lt;send&gt; element
is evaluated and pass the resulting data unmodified to the external
service when the message is delivered. The material <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> consist of
non-XML markup or XML markup in any namespace. Occurs 0 or 1 times.
See <a href="#content"><b>5.7 &lt;content&gt;</b></a> for
details.</li>
</ul>

<p>A conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> specify either 'event', 'eventexpr' or
in-line content. A conformant document <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
specify 'event' in conjunction with the inline content. A
conformant document <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> specify both "namelist" and
&lt;content&gt;.</p>

<p>If 'idlocation' is present, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> generate
an id when the parent &lt;send&gt; element is evaluated and store
it in this location. See <a href="#IDs"><b>3.14 IDs</b></a> for
details.</p>

<p>If a delay is specified via 'delay' or 'delayexpr', the SCXML
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> interpret the character string as a time
interval. It <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> dispatch the message only when the delay
interval elapses. (Note that the evaluation of the
<code>send</code> tag will return immediately.) The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> evaluate
all arguments to &lt;send&gt; when the &lt;send&gt; element is
evaluated, and not when the message is actually dispatched. If the
SCXML session terminates before the delay interval has elapsed, the
SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> discard the message without attempting to
deliver it.</p>
</div>

<div class="div3">
<h4><a id="SendTargets" name="SendTargets" />6.2.4 The Target of
Send</h4>

<p>The target of the &lt;send&gt; operation specifies the
destination of the event. The target is defined by either the
'target' or the 'targetexpr' attribute. In most cases, the format
of the target depends on the type of the target (for example a SIP
URL for SIP-INFO messages or a HTTP URL for Web Services). In
addition, this specification defines the following special values,
which SCXML Processors <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> support:</p>

<ul>
<li>#_internal. If the target is the special term '#_internal', the
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> add the event to the internal event queue
of the sending session.</li>

<li>#_scxml_<em>sessionid</em>. If the target is the special term
'#_scxml_<em>sessionid</em>', where <em>sessionid</em> is the id of
an SCXML session that is accessible to the Processor, the Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> add
the event to the external queue of that session. The set of SCXML
sessions that are accessible to a given SCXML Processor is
platform-dependent.</li>

<li>#_parent. If the target is the special term '#_parent', the
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> add the event to the external event queue
of the SCXML session that invoked the sending session, if there is
one. See <a href="#invoke"><b>6.4 &lt;invoke&gt;</b></a> for
details.</li>

<li>#_<em>invokeid</em>. If the target is the special term
'#_<em>invokeid</em>', where <em>invokeid</em> is the invokeid of
an SCXML session that the sending session has created by
&lt;invoke&gt;, the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> must add the event to the external queue
of that session. See <a href="#invoke"><b>6.4
&lt;invoke&gt;</b></a> for details.</li>
</ul>

<p>If neither the 'target' nor the 'targetexpr' attribute is
specified, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> add the event will be added to the
external event queue of the sending session. If the value of the
'target' or 'targetexpr' attribute is not supported or invalid, the
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the error error.execution on the
internal event queue. If it is unable to reach the target, the
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the error error.communication on
the internal event queue.</p>
</div>

<div class="div3">
<h4><a id="SendTypes" name="SendTypes" />6.2.5 The Type of
Send</h4>

<p>The type of the &lt;send&gt; operation specifies the method that
the SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> use to deliver the message to its target.
A conformant SCXML document <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> use either the 'type' or the 'typeexpr'
attribute to define the type. If neither the 'type' nor the
'typeexpr' is defined, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> assume
the default value of 'scxml. If the SCXML Processor does not
support the type that is specified, it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
event error.execution on the internal event queue.</p>

<p>SCXML Processors <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> support the following type:</p>

<table border="1" cellpadding="2" cellspacing="2"
summary="send type values" width="100%">
<tbody>
<tr>
<th align="center">Value</th>
<th align="center">Details</th>
</tr>

<tr>
<td align="center">"scxml"</td>
<td align="left">Target is an SCXML session. The transport
mechanism is platform-specific.</td>
</tr>
</tbody>
</table>

<p>For details on the 'scxml' type, see <a
href="#SCXMLEventProcessor"><b>E.1 SCXML Event I/O
Processor</b></a>.</p>

<p>Support for HTTP POST is optional, however Processors that
support it <em>must</em> use the following value for the "type"
attribute:</p>

<table border="1" cellpadding="2" cellspacing="2"
summary="send type values" width="100%">
<tbody>
<tr>
<th align="center">Value</th>
<th align="center">Details</th>
</tr>

<tr>
<td align="center">"basichttp"</td>
<td align="left">Target is a URL. Data is sent via HTTP POST</td>
</tr>
</tbody>
</table>

<p>For details on the 'basichttp' type, see <a
href="#BasicHTTPEventProcessor"><b>E.2 Basic HTTP Event I/O
Processor</b></a>.</p>

<p>Support for DOM event delivery is optional, however Processors
that support it <em>must</em> use the following value for the
"type" attribute:</p>

<table border="1" cellpadding="2" cellspacing="2"
summary="send type values" width="100%">
<tbody>
<tr>
<th align="center">Value</th>
<th align="center">Details</th>
</tr>

<tr>
<td align="center">"DOM"</td>
<td align="left">Target is a node in the current document, which
may contain markup from multiple namespaces. A DOM event will be
targeted at that node.</td>
</tr>
</tbody>
</table>

<p>For details on the 'DOM' type, see <a
href="#DOMEventProcessor"><b>E.3 DOM Event I/O
Processor</b></a>.</p>

<p>Processors <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> support other types such as web-services,
SIP or basic HTTP GET. However, they <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em>
assign such types names beginning with "x-" to signify that they
are platform dependent.</p>
</div>

<div class="div3">
<h4><a id="SendContent" name="SendContent" />6.2.6 Message
Content</h4>

<p>The sending SCXML Interpreter <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> not alter
the content of the &lt;send&gt; and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> include
it in the message that it sends to the destination specified in the
target attribute of &lt;send&gt;.</p>

<p>Note that the document author can specify the message content in
one of two mutually exclusive ways:</p>

<ul>
<li>An optional 'event' attribute, combined with an optional
'namelist' attribute, combined with 0 or more &lt;param&gt;
children. Here is an example using the 'event' and 'namelist'
attributes: 

<div class="exampleInner">
<pre>
&lt;datamodel&gt;
&lt;data id="target" expr="'tel:+18005551212'"/&gt;
&lt;data id="content" expr="'http://www.example.com/mycontent.txt'"/&gt;
&lt;/datamodel&gt;
   ...
&lt;send target="target" type="x-messaging" event="fax.SEND" namelist="content"/&gt;
</pre>
</div>
</li>

<li>A single &lt;content&gt; child containing explicit inline XML
content specifying the message body. See <a href="#content"><b>5.7
&lt;content&gt;</b></a> for details. 

<div class="exampleInner">
<pre>
&lt;send target="csta://csta-server.example.com/" type="x-csta"&gt;
      &lt;content&gt;
      &lt;csta:MakeCall&gt;
        &lt;csta:callingDevice&gt;22343&lt;/callingDevice&gt;
        &lt;csta:calledDirectoryNumber&gt;18005551212&lt;/csta:calledDirectoryNumber&gt;
      &lt;/csta:MakeCall&gt;
      &lt;/content&gt;
&lt;/send&gt;
</pre>
</div>
</li>
</ul>

<p>Note that the absence of any error events does not mean that the
event was successfully delivered to its target, but only that the
platform was able to dispatch the event.</p>
</div>
</div>

<div class="div2">
<h3><a id="cancel" name="cancel" />6.3 &lt;cancel&gt;</h3>

<p>The &lt;cancel&gt; element is used to cancel a delayed
&lt;send&gt; event. The SCXML Processor <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
allow &lt;cancel&gt; to affect events that were not raised in the
same document. The Processor <em title="SHOULD in RFC2119 context"
class="RFC2119">SHOULD</em> make its best attempt to cancel the
delayed event. Note, however, that it can not be guaranteed to
succeed, for example if the event has already been delivered by the
time the &lt;cancel&gt; tag executes.</p>

<div class="div3">
<h4><a id="N10F61" name="N10F61" />6.3.1 Attribute Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>sendid</td>
<td>false</td>
<td>Must not occur with sendidexpr.</td>
<td>IDREF</td>
<td>none</td>
<td>The ID of a delayed event</td>
<td>The ID of the event which is to be canceled.</td>
</tr>

<tr>
<td>sendidexpr</td>
<td>false</td>
<td>Must occur with sendid.</td>
<td>Value Expression</td>
<td>none</td>
<td>Any expression that evaluates to the ID of a delayed event</td>
<td>A dynamic alternative to 'sendid'. If this attribute is
present, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate it when the parent
&lt;cancel&gt; element is evaluated and treat the result as if it
had been entered as the value of 'sendid'.</td>
</tr>
</tbody>
</table>
</div>

<p>A conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> specify exactly one of sendid or
sendidexpr.</p>

<div class="div3">
<h4><a id="N10F9F" name="N10F9F" />6.3.2 Children</h4>

<p>None</p>
</div>
</div>

<div class="div2">
<h3><a id="invoke" name="invoke" />6.4 &lt;invoke&gt;</h3>

<p>The &lt;invoke element is used to create an instance of an
external service.</p>

<div class="div3">
<h4><a id="invokeattrs" name="invokeattrs" />6.4.1 Attribute
Details</h4>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>type</td>
<td>false</td>
<td>Must not occur with the 'typeexpr' attribute.</td>
<td>NMTOKEN</td>
<td>none</td>
<td>'scxml', 'vxml2', 'vxml3', 'ccxml', plus other
platform-specific values.</td>
<td>A string specifying the type of the external service. See below
for details.</td>
</tr>

<tr>
<td>typeexpr</td>
<td>false</td>
<td>Must not occur with the 'type' attribute.</td>
<td>value expression</td>
<td>none</td>
<td>Any value expression that evaluates to a character string that
would be a valid value for 'type'.</td>
<td>A dynamic alternative to 'type'. If this attribute is present,
the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate it when the parent
&lt;invoke&gt; element is evaluated and treat the result as if it
had been entered as the value of 'type'.</td>
</tr>

<tr>
<td>src</td>
<td>false</td>
<td>Must not occur with the 'srcexpr' attribute or the
&lt;content&gt; element.</td>
<td>URI</td>
<td>None</td>
<td>Any URI.</td>
<td>A URI to be passed to the external service. See below for
details.</td>
</tr>

<tr>
<td>srcexpr</td>
<td>false</td>
<td>Must not occur with the 'src' attribute or the &lt;content&gt;
element.</td>
<td>Value expression</td>
<td>None</td>
<td>Any expression evaluating to a valid URI.</td>
<td>A dynamic alternative to 'src'. If this attribute is present,
the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> evaluate it when the parent
&lt;invoke&gt; element is evaluated and treat the result as if it
had been entered as the value of 'src'.</td>
</tr>

<tr>
<td>id</td>
<td>false</td>
<td>Must not occur with the 'idlocation' attribute.</td>
<td>ID</td>
<td>none</td>
<td>Any valid token</td>
<td>A string literal to be used as the identifier for this instance
of &lt;invoke&gt;. See <a href="#IDs"><b>3.14 IDs</b></a> for
details.</td>
</tr>

<tr>
<td>idlocation</td>
<td>false</td>
<td>Must not occur with the 'id' attribute.</td>
<td>Location expression</td>
<td>none</td>
<td>Any valid location expression</td>
<td>Any data model expression evaluating to a data model location.
See <a href="#LocationExpressions"><b>5.10.2 Location
Expressions</b></a> for details.</td>
</tr>

<tr>
<td>namelist</td>
<td>false</td>
<td>Must not occur with the &lt;content&gt; element.</td>
<td>List of location expressions</td>
<td>none</td>
<td>List of data model locations</td>
<td>A space-separated list of zero or more data model locations to
be passed to the invoked service. See See <a
href="#DataSharing"><b>6.4.4 Data Sharing</b></a> and <a
href="#LocationExpressions"><b>5.10.2 Location Expressions</b></a>
for details.</td>
</tr>

<tr>
<td>autoforward</td>
<td>false</td>
<td />
<td>boolean</td>
<td>false</td>
<td>true or false</td>
<td>A flag indicating whether to forward events to the invoked
process. See below for details.</td>
</tr>
</tbody>
</table>
</div>

<div class="div3">
<h4><a id="N1104C" name="N1104C" />6.4.2 Children</h4>

<ul>
<li>&lt;param&gt;. Element containing data to be passed to the
external service. Occurs 0 or more times. See <a
href="#param"><b>5.8 &lt;param&gt;</b></a>.</li>

<li>&lt;finalize&gt;. Element containing executable content to
massage the data returned from the invoked component. Occurs 0 or 1
times. See <a href="#finalize"><b>6.5 &lt;finalize&gt;</b></a> for
details.</li>

<li>&lt;content&gt;. Element containing arbitrary material to be
passed to the invoked component. The material <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> consist of
non-XML markup or XML markup in any namespace. Occurs 0 or 1 times.
See <a href="#content"><b>5.7 &lt;content&gt;</b></a> for
details.</li>
</ul>

<p>A conformant SCXML Document <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
specify more than one of 'src', &lt;param&gt;, or &lt;content&gt;.
However it <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> specify &lt;param&gt; multiple times.</p>
</div>

<p>Platforms <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> support 'scxml' as a value for the 'type'
attribute. Platforms <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> support 'vxml2', which indicates a
VoiceXML 2.x interpreter, 'vxml3' which indicates a VoiceXML 3.x
interpreter, and 'ccxml', which indicates a CCXML 1.0 interpreter.
Platforms <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> support additional values, but they <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em> name
the values beginning with "x-" to signify that they are platform
dependent.</p>

<p>A conformant SCXML document <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> specify either the 'id' or 'idlocation'
attribute, but <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> specify both. If the 'idlocation'
attribute is present, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> generate
an id automatically when the &lt;invoke&gt; element is evaluated
and store it in the location specified by 'idlocation'. (In the
rest of this document, we will refer to this identifier as the
"invokeid", regardless of whether it is specified by the author or
generated by the platform). The automatically generated identifier
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> have
the form <em>stateid.platformid</em>, where <em>stateid</em> is the
id of the state containing this element and <em>platformid</em> is
automatically generated. <em>platformid</em> <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> be unique
within the current session.</p>

<p>When the &lt;invoke&gt; element is executed, the SCXML Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> start
a new logical instance of the external service specified in 'type'
or 'typexpr', passing it the URL specified by 'src' or the data
specified by &lt;content&gt;, or &lt;param&gt;. The service
instance <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> be local or remote. In addition to the
explicit arguments, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> keep
track of the unique invokeid and insure that it is included in all
events that the invoked service returns to the invoking
session.</p>

<p>When the 'autoforward' attribute is set to true, the SCXML
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> send an exact copy of every external
event it receives to the invoked process. All the fields specified
in <a href="#InternalStructureofEvents"><b>5.11.1 The Internal
Structure of Events</b></a> <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> have the same values in the forwarded
copy of the event. The SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> forward
the event at the point at which it removes it from the external
event queue of the invoking session for processing. See <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> for details.</p>

<p>The external service <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> return multiple events while it is
processing. If there is a &lt;finalize&gt; handler in the instance
of &lt;invoke&gt; that created the service that generated the
event, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> execute the code in that &lt;finalize&gt;
handler right before it removes the event from the event queue for
processing. It <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> execute the &lt;finalize&gt; handler
in any other instance of &lt;invoke&gt;. Once the external service
has finished processing it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> return a special event
'done.invoke.<em>id</em>' to the external event queue of the
invoking process, where <em>id</em> is the invokeid for the
corresponding &lt;invoke&gt; element. The external service <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
generate any other events after this done event. If the invoking
session takes a transition out of the state containing the
&lt;invoke&gt; before it receives the 'done.invoke.<em>id</em>'
event, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> automatically cancel the invoked
component and stop its processing. The cancel operation <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> act as if
it were the final &lt;onexit&gt; handler in the invoking state.</p>

<p>Invoked services of type 'scxml', 'ccxml', 'vxml2' or 'vxml3'
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
interpret values specified by the &lt;content&gt; element or 'src'
attribute as markup to be executed. Similarly, they <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> interpret
values specified by &lt;param&gt; element or 'namelist' attribute
as values that are to be injected into their data models. For
targets of other invoked service types, the interpretation of
&lt;param&gt; and &lt;content&gt; elements and the 'src' and
'namelist' attributes is platform-specific. However, these services
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> treat
values specified by &lt;param&gt; and namelist identically. They
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> also
treat values specified by 'src' and &lt;content&gt;
identically.</p>

<div class="div3">
<h4><a id="invokeimplementation"
name="invokeimplementation" />6.4.3 Implementation of
&lt;invoke&gt;</h4>

<p>The implementation of &lt;invoke&gt;, including communication
between parent and child processes, is platform-specific, but the
following requirements hold in the case where the invoked process
is itself an SCXML session:</p>

<ul>
<li>If the 'name' of a &lt;param&gt; element in the &lt;invoke&gt;
matches the 'id' of a &lt;data&gt; element in the top-level data
declarations of the invoked session, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use the
value of the &lt;param&gt; element as the initial value of the
corresponding &lt;data&gt; element. (The top-level data
declarations are those that are contained in the &lt;datamodel&gt;
element that is a child of &lt;scxml&gt;.) (Note that this means
that any value specified in the &lt;data&gt; element is ignored.)
The behavior of 'namelist' is similar. If the value of a key in the
namelist matches the 'id' of a &lt;data&gt; element in the
top-level data model of the invoked session, the SCXML Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> use
the value of the key as the initial value of the corresponding
&lt;data&gt; element. If the names do not match, the Processor <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
add the value of the &lt;param&gt; element or namelist key/value
pair the invoked session's data model. However the Processor <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> make the
values available by some other platform-specific means.</li>

<li>When the invoked state machine reaches a top-level final state,
the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the event done.invoke.<em>id</em>
on the external event queue of the invoking machine, where
<em>id</em> is the invokeid for this invocation. Note that reaching
a top level final state corresponds to normal termination of the
machine and that it cannot generate or process any further events
once it is in this state.</li>

<li>As described above, if the invoking state machine exits the
state containing the invocation before it receives the
done.invoke.<em>id</em> event, it cancels the invoked session. To
do this, the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> send the event cancel.invoke.<em>id</em>
to the invoked session, where <em>id</em> is the identifier
corresponding to the &lt;invoke&gt; element. When the invoked
session receives this event, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> act as if
the 'continue' variable specified in <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a> has been set to 'false'. (This will cause
the invoked session to exit at the end of the next microstep. Note
that the cancel.invoke.<em>id</em> is not inserted into the event
queue of the invoked session and is not visible to markup in the
invoked document.) The Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> execute
the &lt;onexit&gt; handlers for all active states in the invoked
session, but it <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> generate the done.invoke.<em>id</em>
event. Once it cancels the invoked session, the Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> ignore
any events it receives from that session. In particular it <em
title="MUST NOT in RFC2119 context" class="RFC2119">MUST NOT</em>
not insert them into the external event queue of the invoking
session.</li>

<li>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> use the SCXML Event/IO processor (<a
href="#SCXMLEventProcessor"><b>E.1 SCXML Event I/O
Processor</b></a>) to communicate between the invoking and the
invoked sessions.</li>
</ul>
</div>

<div class="div3">
<h4><a id="DataSharing" name="DataSharing" />6.4.4 Data
Sharing</h4>

<p>[This section is informative.]</p>

<p>The invoked external resource is logically separate from the
state machine that invokes it and does not share data with it
unless the author explicitly requests this with the &lt;param&gt;
or &lt;content&gt; elements and/or the 'src' and 'namelist'
attributes.</p>

<p>The invoked and invoking process can also communicate via
events. In addition to automatic forwarding specified by the
'autoforward' attribute. SCXML scripts can also use the
&lt;send&gt; tag to send messages to the child process on an ad-hoc
basis. The 'type' attribute of &lt;send&gt; is set to the same
value as was used in the original &lt;invoke&gt;, while the target
has the special form #_<em>invokeid</em>, where <em>invokeid</em>
is the identifier corresponding to the original &lt;invoke&gt; tag.
For example, in a document using ECMAScript as the data model, the
following code would invoke a VXML session:</p>

<div class="exampleInner">
<pre>
  &lt;invoke type="vxml" idlocation="myInvoke"/&gt;
      
</pre>
</div>

<p>In this case, the unique invoke identifier has been stored in
the data model location MyInvoke. Since the target attribute is an
expression which is evaluated, the following code will extract that
identifier and send a message to the invoked VXML session:</p>

<div class="exampleInner">
<pre>
         
  &lt;send type="vxml" targetexpr="'#' + myInvoke"/&gt;
           
</pre>
</div>

<p>Finally, in the case where the invoked external service is an
SCXML session, it can use &lt;send&gt; with the special target
'_parent' and type 'scxml' to send events, possibly containing
data, to the invoking session.</p>
</div>
</div>

<div class="div2">
<h3><a id="finalize" name="finalize" />6.5 &lt;finalize&gt;</h3>

<p>The &lt;finalize&gt; element enables an invoking session to
update its data model with data contained in events returned by the
invoked session. &lt;finalize&gt; contains executable content that
is executed whenever the external service returns an event after
the &lt;invoke&gt; has been executed. This content is applied
before the system looks for transitions that match the event.
Within the executable content, the system variable '_event' can be
used to refer to the data contained in the event which is being
processed.In the case of parallel states, only the finalize code in
the original invoking state is executed.</p>

<div class="div3">
<h4><a id="N11150" name="N11150" />6.5.1 Attribute Details</h4>

<p>None.</p>
</div>

<div class="div3">
<h4><a id="N11155" name="N11155" />6.5.2 Children</h4>

<p>&lt;finalize&gt;'s children consist of 0 or more elements of
executable content.</p>
</div>

<p>In a conformant SCXML document, the executable content inside
&lt;finalize&gt; <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> raise events or invoke external
actions. In particular, the &lt;send&gt; and &lt;raise&gt; elements
<em title="MUST NOT in RFC2119 context" class="RFC2119">MUST
NOT</em> occur.</p>

<p>If no executable content is specified, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> update
the data model with any return values that have a name that matches
the 'location' attribute of a &lt;param&gt; element inside the
&lt;invoke&gt;. Thus the effect of an &lt;invoke&gt; with
&lt;param&gt; element with a 'location' attribute coupled with an
empty &lt;finalize&gt; element is first to send the part of the
data model specified by 'location' to the invoked component and
then to update that part of the data model with the returned
values. Note that the automatic update does not take place if the
&lt;finalize&gt; element is absent as opposed to empty.</p>

<p>In the example below, a state machine using an ECMAScript data
model invokes a clock object that returns the current time in a
ping event with an XML payload that includes the currentSecond,
currentMinute, currentHour (1-12), and an isAm flag.
&lt;finalize&gt; maps this data into an ECMAScript date object that
is used in the condition of a transition. Thus &lt;finalize&gt;
normalizes the data before the conditions on transitions are
evaluated.</p>

<div class="exampleInner">
<pre>
&lt;scxml version="1.0" datamodel="ecmascript"&gt;
....
 &lt;state id="getTime"&gt;
   &lt;transition event="ping" cond="time.getHours() &gt; 17 ||  time.getHours() &lt; 9" target="storeClosed"/&gt;
   &lt;transition event="ping" target="takeOrder"/&gt;
   &lt;datamodel&gt;
     &lt;data id="time" expr="new Date()"/&gt;
   &lt;/datamodel&gt;
   &lt;invoke id="timer" type="x-clock" src="clock.pl"&gt;
     &lt;finalize&gt;
       &lt;script&gt;
         time.setSeconds(_event.data.currentSecond);
         time.setMinutes(_event.data.currentMinute);
         time.setHours(_event.data.currentHour + (_event.isAm ? 0 : 12) - 1);
       &lt;/script&gt;
     &lt;/finalize&gt;
   &lt;/invoke&gt;
 &lt;/state&gt;
....

</pre>
</div>
</div>
</div>
</div>

<div class="back">
<div class="div1">
<h2><a id="AlgorithmforSCXMLInterpretation"
name="AlgorithmforSCXMLInterpretation" />A Algorithm for SCXML
Interpretation</h2>

<p>This section presents a normative algorithm for the
interpretation of an SCXML document. Implementations are free to
implement SCXML interpreters in any way they choose, but they must
behave <em>as if</em> they were using the algorithm defined
here.</p>

<p>The fact that SCXML implements a variant of the Statechart
formalism does not as such determine a semantics for SCXML. Many
different Statechart variants have been proposed, each with its own
semantics. This section presents an informal semantics of SCXML
documents, as well as a normative algorithm for the interpretation
of SCXML documents.</p>

<h2 id="InformalSemantics">Informal Semantics</h2>

<p>The following definitions and highlevel principles and
constraint are intended to provide a background to the normative
algorithm, and to serve as a guide for the proper understanding of
it.</p>

<h3 id="PrelimaryDefinitions">Preliminary definitions</h3>

<dl>
<dt class="label">state</dt>

<dd>An element of type &lt;state&gt;, &lt;parallel&gt;,
&lt;final&gt; or &lt;scxml&gt;.</dd>

<dt class="label">pseudo state</dt>

<dd>An element of type &lt;initial&gt; or &lt;history&gt;.</dd>

<dt class="label">transition target</dt>

<dd>A state, or an element of type &lt;history&gt;.</dd>

<dt class="label">atomic state</dt>

<dd>A state of type &lt;state&gt; with no child states, or a state
of type &lt;final&gt;.</dd>

<dt class="label">compound state</dt>

<dd>A state of type &lt;state&gt; with at least one child
state.</dd>

<dt class="label">configuration</dt>

<dd>The maximal consistent set of states (including parallel and
final states) that the machine is currently in. We note that if a
state s is in the configuration c, it is always the case that the
parent of s (if any) is also in c. Note, however, that
&lt;scxml&gt; is not a(n explicit) member of the
configuration.</dd>

<dt class="label">source state</dt>

<dd>The source state of a transition is the atomic state from which
the transition departs.</dd>

<dt class="label">target state</dt>

<dd>A target state of a transition is a state that the transition
is entering. Note that a transition can have zero or more target
states.</dd>

<dt class="label">targetless transition</dt>

<dd>A transition having zero target states.</dd>

<dt class="label">eventless transition</dt>

<dd>A transition lacking the 'event' attribute.</dd>

<dt class="label">external event</dt>

<dd>An SCXML event appearing in the external event queue. Such
events are either sent by external sources or generated with the
&lt;send&gt; element.</dd>

<dt class="label">internal event</dt>

<dd>An event appearing in the internal event queue. Such events are
either raised automatically by the platform or generated with the
&lt;event&gt; element.</dd>

<dt class="label">microstep</dt>

<dd>A microstep involves the processing of a single transition (or,
in the case of parallel states, a single set of transitions.) A
microstep may change the the current configuration, update the
datamodel and/or generate new (internal and/or external) events.
This, by causality, may in turn enable additional transitions which
will be handled in the next microstep in the sequence, and so
on.</dd>

<dt class="label">macrostep</dt>

<dd>A macrostep consists of a sequence (a chain) of microsteps, at
the end of which the state machine is in a stable state and ready
to process an external event. Each external event causes an SCXML
state machine to take exactly one macrostep. However, if the
external event does not enable any transitions, no microstep will
be taken, and the corresponding macrostep will be empty.</dd>
</dl>

<h3 id="PrinciplesandConstraints">Principles and Constraints</h3>

<p>We state here some principles and constraints, on the level of
semantics, that SCXML adheres to:</p>

<dl>
<dt class="label">Encapsulation</dt>

<dd>An SCXML processor is a <em>pure event processor</em>. The only
way to get data into an SCXML statemachine is to send external
events to it. The only way to get data out is to receive events
from it.</dd>

<dt class="label">Causality</dt>

<dd>There shall be a <em>causal justification</em> of why events
are (or are not) returned back to the environment, which can be
traced back to the events provided by the system environment.</dd>

<dt class="label">Determinism</dt>

<dd>An SCXML statemachine which does not invoke any external event
processor must always react with the same behavior (i.e. the same
sequence of output events) to a given sequence of input events
(unless, of course, the statemachine is explicitly programmed to
exhibit an non-deterministic behavior). In particular, the
availability of the &lt;parallel&gt; element must not introduce any
non-determinism of the kind often associated with concurrency. Note
that observable determinism does not necessarily hold for state
machines that invoke other event processors.</dd>

<dt class="label">Completeness</dt>

<dd>An SCXML interpreter must always treat an SCXML document as
<em>completely</em> specifying the behavior of a statemachine. In
particular, SCXML is designed to use priorities (based on document
order) to resolve situations which other statemachine frameworks
would allow to remain under-specified (and thus non-deterministic,
although in a different sense from the above).</dd>

<dt class="label">Run to completion</dt>

<dd>SCXML adheres to a run to completion semantics in the sense
that an external event can only be processed when the processing of
the previous external event has completed, i.e. when all microsteps
(involving all triggered transitions) have been completely
taken.</dd>

<dt class="label">Termination</dt>

<dd>A microstep always terminates. A macrostep may not. A macrostep
that does not terminate may be said to consist of an infinitely
long sequence of microsteps. This is currently allowed.</dd>
</dl>

<h2 id="Algorithm">Algorithm</h2>

<p>This section presents a normative algorithm for the
interpretation of SCXML documents. Implementations are free to
implement SCXML interpreters in any way they choose, but they must
behave as <em>if</em> they were using the algorithm defined here.
Note that the algorithm assumes a Lisp-like semantics in which the
empty Set null is equivalent to boolean 'false' and all other
entities are equivalent to 'true'.</p>

<h3 id="Datatypes">Datatypes</h3>

<p>These are the abstract datatypes that are used in the
algorithm.</p>

<pre>
datatype List
   <code>function</code> head()      // Returns the head of the list
   <code>function</code> tail()      // Returns the tail of the list
   <code>function</code> append(l)   // Returns the list appended with l
   <code>function</code> filter(f)   // Returns the list of elements that satisfy the predicate f
   <code>function</code> some(f)     // Returns true if some element in the list satisfies the predicate f
   <code>function</code> every(f)    // Returns true if every element in the list satisfies the predicate f

datatype OrderedSet
   <code>procedure</code> add(e)     // Adds e to the set if it is not already a member
   <code>procedure</code> delete(e)  // Deletes e from the set
   <code>function</code> member(e)   // Is e a member of set?
   <code>function</code> isEmpty()   // Is the set empty?
   <code>function</code> toList()    // Converts the set to a list that reflects the order in which elements were originally added.
   <code>procedure</code> clear()    // Remove all elements from the set (make it empty)   
   <code>function</code> diff(set2)  // Returns an OrderedSet containing all members of OrderedSet that are not in set2, preserving the original set order. 


datatype Queue
   <code>procedure</code> enqueue(e) // Puts e last in the queue
   <code>function</code> dequeue()   // Removes and returns first element in queue
   <code>function</code> isEmpty()   // Is the queue empty?

datatype BlockingQueue
   <code>procedure</code> enqueue(e) // Puts e last in the queue
   <code>function</code> dequeue()   // Removes and returns first element in queue, blocks if queue is empty
</pre>

<h3 id="GlobalVariables">Global variables</h3>

<p>The following variables are global from the point of view of the
algorithm. Their values will be set in the
procedureinterpret().</p>

<pre>
global configuration
global previousConfiguration
global statesToInvoke
global datamodel
global internalQueue
global externalQueue
global historyValue
global continue
global binding
</pre>

<h3 id="Predicates">Predicates</h3>

<p>The following binary predicates are used for determining the
order in which states are entered and exited.</p>

<pre>
<code><a id="entryOrder"
name="entryOrder">entryOrder</a></code> // Ancestors precede descendants, with document order being used to break ties
<code><a id="exitOrder"
name="exitOrder">exitOrder</a></code>  // Descendants precede ancestors, with reverse document order being used to break ties
</pre>

<h3 id="ProceduresandFunctions">Procedures and Functions</h3>

<p>This section defines the procedures and functions that make up
the core of the SCXML interpreter.</p>

<h4 id="interpret"><code>procedure</code> interpret(scxml,id)</h4>

<p>The purpose of this procedure is to initialize the interpreter
and to start processing. It is called with a parsed representation
of an SCXML document.</p>

<p>In order to interpret an SCXML document, first convert initial
attributes to &lt;initial&gt; container children with transitions
to the state specified by the attribute (such transitions will not
contain any executable content). Then (optionally) validate the
resulting SCXML, and throw an exception if validation fails. Create
an empty configuration complete with a new populated instance of
the data model and a execute the global scripts. Create the two
queues to handle events and set the global continue variable to
true. Finally call enterState on the initial transition that is a
child of scxml and start the interpreter's event loop.</p>

<pre>
procedure interpret(doc):
    expandScxmlSource(doc)
    if not valid(doc): failWithError()
    configuration = new OrderedSet()
    previousConfiguration = new OrderedSet()
    statesToInvoke = new OrderedSet()
    datamodel = new Datamodel(doc)
    executeGlobalScriptElements(doc)
    internalQueue = new Queue()
    externalQueue = new BlockingQueue()
    continue = true
    binding = doc.binding
    if binding == "early":
        initializeDatamodel(datamodel, doc)
    enterState([doc.initial.transition])
    startEventLoop()
</pre>

<h4 id="startEventLoop"><code>procedure</code>
startEventLoop()</h4>

<p>Upon entering the state machine, we take all internally enabled
transitions, namely those that either don't require an event or
that are triggered by internal events. (Internal events can only be
generated by the state machine itself.) When all such transitions
have been taken, we move to the main event loop, which is driven by
external events.</p>

<pre>
procedure startEventLoop():
    initialStepComplete = false
    until initialStepComplete:
        enabledTransitions = selectEventlessTransitions()
        if enabledTransitions.isEmpty():
            if internalQueue.isEmpty(): 
                initialStepComplete = true 
            else:
                internalEvent = internalQueue.dequeue()
                datamodel["event"] = internalEvent
                enabledTransitions = selectTransitions(internalEvent)
        if not enabledTransitions.isEmpty():
            microstep(enabledTransitions.toList())
    mainEventLoop()
</pre>

<h4 id="mainEventLoop"><code>procedure</code> mainEventLoop()</h4>

<p>This loop runs until we enter a top-level final state or an
external entity cancels processing. In either case 'continue' will
be set to false (see EnterStates, below, for termination by
entering a top-level final state.)</p>

<p>Each iteration through the loop consists of three main steps: 1)
execute any &lt;invoke&gt; tags for states that we entered on the
last iteration through the loop 2) Wait for an external event and
then execute any transitions that it triggers. However special
preliminary processing is applied to the event if the state has
executed any &lt;invoke&gt; elements. First, if this event was
generated by an invoked process, apply &lt;finalize&gt; processing
to it. Secondly, if any &lt;invoke&gt; elements have autoforwarding
set, forward the event to them. These steps apply before the
transitions are taken. 3) Take any subsequent internally enabled
transitions, namely those that don't require an event or that are
triggered by an internal event.</p>

<p>This event loop thus enforces run-to-completion semantics, in
which the system process an external event and then takes all the
'follow-up' transitions that the processing has enabled before
looking for another external event. For example, suppose that the
<em>external</em> event queue contains events ext1 and ext2 and the
machine is in state s1. If processing ext1 takes the machine to s2
and generates <em>internal</em> event int1, and s2 contains a
transition t triggered by int1, the system is guaranteed to take t,
no matter what transitions s2 or other states have that would be
triggered by ext2. Note that this is true even though ext2 was
already in the external event queue when int1 was generated. In
effect, the algorithm treats the processing of int1 as finishing up
the processing of ext1.</p>

<pre>
procedure mainEventLoop():
    while continue:
        for state in statesToInvoke:
            for inv in state.invoke:
                invoke(inv)
        statesToInvoke.clear()
        previousConfiguration = configuration
        externalEvent = externalQueue.dequeue() # this call blocks until an event is available        
        datamodel["event"] = externalEvent
        for state in configuration:
            for inv in state.invoke:
                if inv.invokeid == externalEvent.invokeid:  # event is the result of an &lt;invoke&gt; in this state
                    applyFinalize(inv, externalEvent)
                if inv.autoforward:
                    send(inv.id, externalEvent)    
        enabledTransitions = selectTransitions(externalEvent)
        if not enabledTransitions.isEmpty():
            microstep(enabledTransitions.toList())
            # now take any newly enabled null transitions and any transitions triggered by internal events
            macroStepComplete = false 
            until macroStepComplete:
                enabledTransitions = selectEventlessTransitions()
                if enabledTransitions.isEmpty():
                    if internalQueue.isEmpty(): 
                        macroStepComplete = true 
                    else:
                        internalEvent = internalQueue.dequeue()
                        datamodel["event"] = internalEvent
                        enabledTransitions = selectTransitions(internalEvent)
                if not enabledTransitions.isEmpty():
                    microstep(enabledTransitions.toList())   
    # if we get here, we have reached a top-level final state or some external entity has set continue to false         
    exitInterpreter()      
</pre>

<h4 id="exitInterpreter"><code>procedure</code>
exitInterpreter()</h4>

<p>The purpose of this procedure is to exit the current SCXML
process by exiting all active states. If the machine is in a
top-level final state, a Done event is generated. (Note that in
this case, the final state will be the only active state.) The
implementation of returnDoneEvent is platform-dependent, but if
this session is the result of an &lt;invoke&gt; in another SCXML
session, returnDoneEvent will cause the event
done.invoke.&lt;id&gt; to be placed in the external event queue of
that session, where &lt;id&gt; is the id generated in that session
when the &lt;invoke&gt; was executed.</p>

<pre>
procedure exitInterpreter():
    statesToExit = configuration.toList().sort(exitOrder)
    for s in statesToExit:
        for content in s.onexit:
            executeContent(content)
        for inv in s.invoke:
            cancelInvoke(inv)
        configuration.delete(s)
        if isFinalState(s) and isScxmlState(s.parent):   
            returnDoneEvent(s.donedata)
</pre>

<h4 id="selectEventlessTransitions"><code>function</code>
selectEventlessTransitions()</h4>

<p>This function selects all transitions that are enabled in the
current configuration that do not require an event trigger. First
test if the state has been preempted by a transition that has
already been selected and that will cause the state to be exited
when it is taken. If the state has not been preempted, find a
transition with no 'event' attribute whose condition evaluates to
<code>true</code>. If multiple matching transitions are present,
take the first in document order. If none are present, search in
the state's ancestors in ancestry order until one is found. As soon
as such a transition is found, add it to enabledTransitions, and
proceed to the next atomic state in the configuration. If no such
transition is found in the state or its ancestors, proceed to the
next state in the configuration. When all atomic states have been
visited and transitions selected, return the set of enabled
transitions.</p>

<pre>
function selectEventlessTransitions():
    enabledTransitions = new OrderedSet()
    atomicStates = configuration.toList().filter(isAtomicState).sort(documentOrder)
    for state in atomicStates:
        if not isPreempted(state, enabledTransitions):
            loop: for s in [state].append(getProperAncestors(state, null)):
                for t in s.transition:
                    if not t.event and conditionMatch(t): 
                        enabledTransitions.add(t)
                        break loop
    return enabledTransitions
</pre>

<h4 id="selectTransitions"><code>function</code>
selectTransitions(event)</h4>

<p>The purpose of the selectTransitions()procedure is to collect
the transitions that are enabled by this event in the current
configuration.</p>

<p>Create an empty set of <code>enabledTransitions</code>. For each
atomic state test if the state has been preempted by a transition
that has already been selected and that will cause the state to be
exited when it is taken. If the state has not been preempted, find
a transition whose 'event' attribute matches <code>event</code> and
whose condition evaluates to <code>true</code>. If multiple
matching transitions are present, take the first in document order.
If none are present, search in the state's ancestors in ancestry
order until one is found. As soon as such a transition is found,
add it to enabledTransitions, and proceed to the next atomic state
in the configuration. If no such transition is found in the state
or its ancestors, proceed to the next state in the configuration.
When all atomic states have been visited and transitions selected,
return the set of enabled transitions.</p>

<pre>
function selectTransitions(event):
    enabledTransitions = new OrderedSet()
    atomicStates = configuration.toList().filter(isAtomicState).sort(documentOrder)
    for state in atomicStates:
        if not isPreempted(state, enabledTransitions):
            loop: for s in [state].append(getProperAncestors(state, null)):
                for t in s.transition:
                    if t.event and nameMatch(t.event, event.name) and conditionMatch(t):
                        enabledTransitions.add(t)
                        break loop
    return enabledTransitions
</pre>

<h4 id="isPreempted"><code>function</code> isPreempted(s
transitionList)</h4>

<p>Return true if a transition T in transitionList exits an
ancestor of state s. In this case, taking T will pull the state
machine out of s and thus we say that it preempts the selection of
a transition from s. Such preemption will occur only if s is a
descendant of a parallel region and T exits that region. If we did
not do this preemption check, we could end up in an illegal
configuration, namely one in which there were multiple active
states that were not all descendants of a common parallel
ancestor.</p>

<pre>
function isPreempted(s, transitionList):
    preempted = false 
    for t in transitionList:
        if t.target:
            LCA = findLCA([t.source].append(getTargetStates(t.target)))
            if isDescendant(s,LCA):
                preempted = true 
                break
    return preempted
</pre>

<h4 id="microstepProcedure"><code>procedure</code>
microstep(enabledTransitions)</h4>

<p>The purpose of the microstep <code>procedure</code> is to
process a single set of transitions. These may have been enabled by
an external event, an internal event, or by the presence or absence
of certain values in the datamodel at the current point in time.
The processing of the enabled transitions must be done in parallel
('lock step') in the sense that their source states must first be
exited, then their actions must be executed, and finally their
target states entered.</p>

<p>If a single atomic state is active, then enabledTransitions will
contain only a single transition. If multiple states are active
(i.e., we are in a parallel region), then there may be multiple
transitions, one per active atomic state (though some states may
not select a transition.) In this case, the transitions are taken
in the document order of the atomic states that selected them.</p>

<pre>
procedure microstep(enabledTransitions):
    exitStates(enabledTransitions)
    executeTransitionContent(enabledTransitions)
    enterStates(enabledTransitions)
</pre>

<h4 id="exitStates"><code>procedure</code>
exitStates(enabledTransitions)</h4>

<p>Create an empty statesToExit set. For each transition t in
enabledTransitions, if t is targetless then do nothing, else let
LCA be the least common ancestor state of the source state and
target states of t. Add to the statesToExit set all states in the
configuration that are descendants of LCA. Next remove all the
states on statesToExit from the set of states that will have invoke
processing done at the start of the next macrostep. (Suppose
macrostep M1 consists of microsteps m11 and m12. We may enter state
s in m11 and exit it in m12. We will add s to statesToInvoke in
m11, and must remove it in m12. In the subsequent macrostep M2, we
will apply invoke processing to all states that were enter, and not
exited, in M1.) Then convert statesToExit to a list and sort it in
exitOrder.</p>

<p>For each state s in the list, if s has a deep history state h,
set the history value of h to be the list of all atomic descendants
of s that are members in the current configuration, else set its
value to be the list of all immediate children of s that are
members of the current configuration. Again for each state s in the
list, first execute any onexit handlers, then cancel any ongoing
invocations, and finally remove s from the current
configuration.</p>

<pre>
procedure exitStates(enabledTransitions):
   statesToExit = new OrderedSet()
   for t in enabledTransitions:
       if t.target:
           if t.type == "internal" and getTargetStates(t.target).every(lambda s: isDescendant(s,t.source)):
               ancestor = t.source
           else:
               ancestor = findLCA([t.source].append(getTargetStates(t.target)))
           for s in configuration:
               if isDescendant(s,ancestor):
                   statesToExit.add(s)                    
    for s in statesToExit:
        statesToInvoke.delete(s)
    statesToExit = statesToExit.toList().sort(exitOrder)
    for s in statesToExit:
        for h in s.history:
            if h.type == "deep":
                f = lambda s0: isAtomicState(s0) and isDescendant(s0,s) 
            else:
                f = lambda s0: s0.parent == s
            historyValue[h.id] = configuration.toList().filter(f)
    for s in statesToExit:
        for content in s.onexit:
            executeContent(content)
        for inv in s.invoke:
            cancelInvoke(inv)
        configuration.delete(s)
</pre>

<h4 id="executeTransitionContent"><code>procedure</code>
executeTransitionContent(enabledTransitions)</h4>

<p>For each transition in the list of
<code>enabledTransitions</code>, execute its executable
content.</p>

<pre>
procedure executeTransitionContent(enabledTransitions):
    for t in enabledTransitions:
        executeContent(t)
</pre>

<h4 id="enterStates"><code>procedure</code>
enterStates(enabledTransitions)</h4>

<p>Create an empty statesToEnter set, and an empty
statesForDefaultEntry set. For each transition t in
enabledTransitions, if t is targetless then do nothing, else for
each target state s, call addStatesToEnter. This will add to
statesToEnter s plus any descendent states that will have to be
entered by default once s is entered. (If s is atomic, there will
not be any such states.) Now for each target state s, add any of
s's ancestors that must be entered when s is entered. (These will
be any ancestors of s that are not currently active. Note that
statesToEnter is a set, so it is harmless if the same ancestor is
entered multiple times.) In the case where the ancestor state is
parallel, call addStatesToEnter on any of its child states that do
not already have a descendent on statesToEnter. (If a child state
already has a descendant on statesToEnter, it will get added to the
list when we examine the ancestors of that descendant.)</p>

<p>We now have a complete list of all the states that will be
entered as a result of taking the transitions in
enabledTransitions. Add them to statesToInvoke so that invoke
processing can be done at the start of the next macrostep. Convert
statesToEnter to a list and sort it in entryorder. For each state s
in the list, first add s to the current configuration. Then if we
are using late binding, and this is the first time we have entered
s, initialize its data model. Then execute any onentry handlers. If
s's initial state is being entered by default, execute any
executable content in the initial transition. Finally, if s is a
final state, generate relevant Done events. If we have reached a
top-level final state, set continue to false as a signal to stop
processing.</p>

<pre>
procedure enterStates(enabledTransitions):
    statesToEnter = new OrderedSet()
    statesForDefaultEntry = new OrderedSet()
    for t in enabledTransitions:
        if t.target:
            tstates = getTargetStates(t.target)
            if t.type == "internal" and tstates.every(lambda s: isDescendant(s,t.source)):
                ancestor = t.source
            else:
                ancestor = findLCA([t.source].append(tstates))
            for s in tstates:
                addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
            for s in tstates:
                for anc in getProperAncestors(s,ancestor):
                    statesToEnter.add(anc)
                    if isParallelState(anc):
                        for child in getChildStates(anc):
                            if not statesToEnter.some(lambda s: isDescendant(s,child)):
                                addStatesToEnter(child,statesToEnter,statesForDefaultEntry)  
    for s in statesToEnter:
        statesToInvoke.add(s)
    statesToEnter = statesToEnter.toList().sort(enterOrder)
    for s in statesToEnter:
        configuration.add(s)
        if binding == "late" and s.isFirstEntry:
            initializeDataModel(datamodel.s,doc.s)
            s.isFirstEntry = false
        for content in s.onentry:
            executeContent(content)
        if statesForDefaultEntry.member(s):
            executeContent(s.initial.transition)
        if isFinalState(s):
            parent = s.parent
            grandparent = parent.parent
            internalQueue.enqueue(new Event("done.state." + parent.id, parent.donedata))
            if isParallelState(grandparent):
                if getChildStates(grandparent).every(isInFinalState):
                    internalQueue.enqueue(new Event("done.state." + grandparent.id, grandparent.donedata))
    for s in configuration:
        if isFinalState(s) and isScxmlState(s.parent):
            continue = false
</pre>

<h4 id="addStatesToEnter"><code>procedure</code>
addStatesToEnter(state,root,statesToEnter,statesForDefaultEntry)</h4>

<p>The purpose of this procedure is to add to statesToEnter state
and/or any of its descendants that must be entered as a result of
state being the target of a transition. Note that this procedure
permanently modifies both statesToEnter and
statesForDefaultEntry.</p>

<p>First, If state is a history state then add either the history
values associated with state or state's default target to
statesToEnter. Else (if state is not a history state), add state to
statesToEnter. Then, if state is a a compound state, add state to
statesForDefaultEntry and recursively call addStatesToenter on its
default initial state(s). Otherwise, if state is a parallel state,
recursively call addStatesToEnter on each of its child states.</p>

<pre>
procedure addStatesToEnter(state,statesToEnter,statesForDefaultEntry):
    if isHistoryState(state):
        if historyValue[state.id]:
            for s in historyValue[state.id]:
                addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
        else:
            for t in state.transition:
                for s in getTargetStates(t.target):
                    addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
    else:
        statesToEnter.add(state)
        if isCompoundState(state):
            statesForDefaultEntry.add(state)
            for s in getTargetStates(state.initial):
                addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
        elif isParallelState(state):
            for s in getChildStates(state):
                addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
</pre>

<h4 id="isInFinalState"><code>procedure</code>
isInFinalState(s)</h4>

<p>Return true if s is a compound &lt;state&gt; and one of its
children is an active &lt;final&gt; state (i.e. is a member of the
current configuration), or if s is a &lt;parallel&gt; state and
isInFinalState is true of all its children.</p>

<pre>
function isInFinalState(s):
    if isCompoundState(s):
        return getChildStates(s).some(lambda s: isFinalState(s) and configuration.member(s))
    elif isParallelState(s):
        return getChildStates(s).every(isInFinalState)
    else:
        return false
</pre>

<h4 id="findLCA"><code>function</code> findLCA(stateList)</h4>

<p>The <a id="LCA" name="LCA">Least Common Ancestor</a> is the
element s such that s is a proper ancestor of all states on
stateList and no descendant of s has this property. Note that there
is guaranteed to be such an element since the &lt;scxml&gt; wrapper
element is a common ancestor of all states. Note also that since we
are speaking of proper ancestor (parent or parent of a parent,
etc.) the LCA is never a member of stateList.</p>

<pre>
function findLCA(stateList):
    for anc in getProperAncestors(stateList.head(), null):
        if stateList.tail().every(lambda s: isDescendant(s,anc)):
            return anc
</pre>
</div>

<div class="div1">
<h2><a id="schemas" name="schemas" />B Schema</h2>

<p>The schemas for SCXML can be found in <a
href="http://www.w3.org/2011/04/SCXML/">www.w3.org/2011/04/SCXML</a>.
The master schema is <a
href="http://www.w3.org/2011/04/SCXML/scxml.xsd">http://www.w3.org/2011/04/SCXML/scxml.xsd</a>.
The schema for SCXML messages is <a
href="http://www.w3.org/2011/04/SCXML/scxml.xsd">http://www.w3.org/2011/04/SCXML/scxml-message.xsd</a></p>
</div>

<div class="div1">
<h2><a id="conformance" name="conformance" />C Conformance</h2>

<p>This section is normative.</p>

<div class="div2">
<h3><a id="ConformingDocuments" name="ConformingDocuments" />C.1
Conforming Documents</h3>

<p>The following conformance requirements hold for all SCXML
documents.</p>

<ol class="enumar">
<li>The root element of the document <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> be
&lt;scxml&gt;.</li>

<li>The &lt;scxml&gt; element <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> include a "version" attribute with the
value "1.0".</li>

<li>The &lt;scxml&gt; element <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> designate the SCXML namespace. This can
be achieved by declaring an "xmlns" attribute or an attribute with
an "xmlns" prefix <a href="#XMLNames">[XMLNames]</a>. The namespace
for SCXML is defined to be http://www.w3.org/2005/07/scxml.</li>

<li>The document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> conform to all the syntactic constraints
defined in this specification, including those contained in the
schema, those contained in the "Attribute Constraints" and "Valid
Values" fields in the attribute tables, and those contained in the
definition of its children.</li>

<li>The document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> conform to any additional syntactic
constraints that are defined for the data model that it has chosen.
See <a href="#profiles"><b>D Data Models</b></a> for the definition
of the individual data models.</li>
</ol>
</div>

<div class="div2">
<h3><a id="ConformingProcessors" name="ConformingProcessors" />C.2
Conforming Processors</h3>

<p>A SCXML 1.0 processor is a user agent that can parse and process
Conforming SCXML 1.0 documents.</p>

<p>In a Conforming SCXML 1.0 Processor, the XML parser <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> be able
to parse and process all well-formed XML constructs defined within
<a href="#XML">[XML]</a> and <a href="#XMLNames">[XMLNames]</a>. It
is not required that a Conforming SCXML 1.0 processor use a
validating parser.</p>

<p>A Conforming SCXML 1.0 Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> support
the syntax and semantics of all mandatory SCXML elements described
in this document. A Conforming SCXML 1.0 Processor <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> support the
syntax and semantics of any optional SCXML elements described in
this document. A Conforming SCXML 1.0 Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> behave as
if it were executing the algorithm specified in <a
href="#AlgorithmforSCXMLInterpretation"><b>A Algorithm for SCXML
Interpretation</b></a>.</p>

<p>When a Conforming SCXML 1.0 Processor encounters a Conforming
SCXML 1.0 Document with non-SCXML elements or attributes which are
proprietary, or defined in a non-SCXML namespace, it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> behave as
instructed by the 'exmode' attribute.</p>

<p>When a Conforming SCXML 1.0 Processor encounters a nonconformant
document, then if 'exmode' is "strict", it <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> reject
the document and <em title="SHOULD in RFC2119 context"
class="RFC2119">SHOULD</em> signal an error to the entity that
requested the execution of the document. The means of signaling
this error are platform-specific and outside the scope of this
specification. Note specifically that in this case, a Conforming
SCXML Processor <em title="MUST NOT in RFC2119 context"
class="RFC2119">MUST NOT</em> enter the initial state of a
nonconformant SCXML document. When a Conforming SCXML 1.0 Processor
encounters a nonconformant document, and 'exmode' is not "strict",
its behavior is undefined.</p>

<p>There is no conformance requirement with respect to performance
characteristics of the SCXML 1.0 Processor.</p>
</div>
</div>

<div class="div1">
<h2><a id="profiles" name="profiles" />D Data Models</h2>

<p>The 'datamodel' attribute on &lt;scxml&gt; defines the data
model that the document uses. The data model includes the
underlying data structure plus languages for boolean expressions,
location expressions, value expressions, and scripting. Each
conformant SCXML document <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> specify the data model it uses. (Note
that the "null" data model is the default.) Conformant SCXML
processors <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> support the null data model, and <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> support
other data models, including the ECMAScript and XPath data models.
The ECMAScript and XPath model definitions given here are normative
in the sense that they define how implementations that support one
of these languages <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> behave. The intent is to insure
interoperability among all processors that support ECMAScript, and
all those that support XPath, without requiring all implementations
to support either of those data model languages.</p>

<p>The definition of a data model <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em>:</p>

<ul>
<li>Specify the boolean expression language used as the value of
the'cond' attribute in &lt;transition&gt;, &lt;if&gt; and
&lt;elseif&gt; This language <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> not have side effects and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> include
the predicate 'In', which takes a single argument, the id of a
state in the enclosing state machine, and returns 'true' if the
state machine is in that state.</li>

<li>Specify the location expression language that is used as the
value of the 'location' attribute of the &lt;assign&gt; tag.</li>

<li>Specify the value expression language that is used as the value
of the 'expr' attribute of the &lt;data&gt; and &lt;assign&gt;
elements.</li>

<li>Specify the scripting language used inside the &lt;script&gt;
element</li>
</ul>

<div class="div2">
<h3><a id="minimal-profile" name="minimal-profile" />D.1 The Null
Data Model</h3>

<p>The value "null" for the 'datamodel' attribute results in an
absent or empty data model. In particular:</p>

<div class="div3">
<h4><a id="N11387" name="N11387" />D.1.1 Data Model</h4>

<p>There is no underlying data model.</p>
</div>

<div class="div3">
<h4><a id="N1138C" name="N1138C" />D.1.2 Conditional
Expressions</h4>

<p>The boolean expression language consists of the In predicate
<em>only</em>. It has the form 'In(<em>id</em>)', where <em>id</em>
is the id of a state in the enclosing state machine. The predicate
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
return 'true' if and only if that state is in the current state
configuration.</p>
</div>

<div class="div3">
<h4><a id="N1139D" name="N1139D" />D.1.3 Location Expressions</h4>

<p>There is no location expression language.</p>
</div>

<div class="div3">
<h4><a id="N113A2" name="N113A2" />D.1.4 Value Expressions</h4>

<p>There is no value expression language.</p>
</div>

<div class="div3">
<h4><a id="N113A7" name="N113A7" />D.1.5 Scripting</h4>

<p>There is no scripting language.</p>
</div>

<div class="div3">
<h4><a id="N113AC" name="N113AC" />D.1.6 System Variables</h4>

<p>System variables are not accessible.</p>
</div>

<div class="div3">
<h4><a id="N113B1" name="N113B1" />D.1.7 Unsupported Elements</h4>

<p>The &lt;foreach&gt; element and the elements defined in <a
href="#data-module"><b>5 Data Model and Data Manipulation</b></a>
are not supported in the Null Data Model. If the SCXML processor
encounters a document specifying the Null Data Model and containing
one of these elements, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> behave as instructed by the 'exmode'
attribute on &lt;scxml&gt;. See <a href="#scxml"><b>3.2
&lt;scxml&gt;</b></a> for details.</p>
</div>
</div>

<div class="div2">
<h3><a id="ecma-profile" name="ecma-profile" />D.2 The ECMAScript
Data Model</h3>

<p>The value 'ecmascript' for the 'datamodel' attribute results in
an ECMASccript data model. Implementations that support this value
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
support the third edition of ECMAScript <a
href="#ECMAScript262">[ECMASCRIPT-262]</a>. Implementations <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> support
ECMAScript for XML (E4X) <a href="#E4X">[E4X]</a>.</p>

<div class="div3">
<h4><a id="ecma_core_module" name="ecma_core_module" />D.2.1 Data
Model</h4>

<p>For each &lt;data&gt; element in the document, the SCXML
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> create an ECMAScript variable object
whose name is the value of the "id" attribute of
<code>&lt;data&gt;</code>. Note that the value of the variable can
be assigned in one of the following three ways:</p>

<ul>
<li>value of the "expr" attribute</li>

<li>resource referenced by the value of the "src" attribute</li>

<li>inline content</li>
</ul>

<p>If no value is assigned, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> assign
the variable the default value ECMAScript undefined. Note that the
assignment takes place at the time indicated by the 'binding'
attribute on the &lt;scxml&gt; element.</p>

<p>The Processor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> support evaluation of JSON expressions and
of XML expressions.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N113ED" name="N113ED" />Example:
Datamodel &lt;data&gt; initialization</div>

<div class="exampleInner">
<pre>
&lt;scxml version="1.0" datamodel="ecmascript"&gt;
  &lt;datamodel&gt;
   &lt;data id="employees" src="http://example.com/employees.json"/&gt;
   &lt;data id="year" expr="2008"/&gt;
   &lt;data id="CEO" expr="\"Mr Big\""/&gt;
   &lt;data id="profitable" expr="true"/&gt;
  &lt;/datamodel&gt;
&lt;/scxml&gt;
</pre>
</div>
</div>

<p>The Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place all variables in a single global
ECMAScript scope.</p>
</div>

<div class="div3">
<h4><a id="ecma_cond_expressions"
name="ecma_cond_expressions" />D.2.2 Conditional Expressions</h4>

<p>The Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> convert ECMAScript expressions used in
conditional expressions into their effective boolean value using
the ToBoolean operator as described in Section 9.2 of <a
href="#ECMAScript262">[ECMASCRIPT-262]</a>.</p>

<p>The following example illustrates this usage.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11406" name="N11406" />Example:
Use of a boolean expression to determine whether or not a
transition is taken.</div>

<div class="exampleInner">
<pre>
&lt;state id="errorSwitch"&gt;
  &lt;datamodel&gt;
   &lt;data id="time"/&gt;
  &lt;/datamodel&gt;
        
  &lt;onentry&gt;
    &lt;assign location="time" expr="currentDateTime()"/&gt;
  &lt;/onentry&gt;
          
  &lt;transition cond="yearFromDatetime(time) &gt; 2009" target="newBehavior"/&gt;
 
  &lt;transition target="currentBehavior"/&gt;
&lt;/state&gt;
</pre>
</div>
</div>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> add an ECMAScript function to the SCXML
namespace that takes a stateID as its argument and returns 'true'
if that state is in the current state configuration, as described
in <a href="#ConditionalExpressions"><b>5.10.1 Conditional
Expressions</b></a>. Here is an example of its use, taken from <a
href="#MicrowaveParallel"><b>G.3 Microwave Example (Using
parallel)</b></a> below:</p>

<div class="exampleOuter">
<pre>
 
  &lt;transition cond="In('closed')" target="cooking"/&gt;
</pre>
</div>
</div>

<div class="div3">
<h4><a id="ecma_location_expressions"
name="ecma_location_expressions" />D.2.3 Location Expressions</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> accept any ECMAScript left-hand-side
expression as a location expression. The following example
illustrates this usage. (Note that the example assumes that the
data loaded from http://http://example.com/employees.json creates
the necessary data structure, so that employees.employee[12].salary
exists when &lt;assign&gt; is evaluated. If it didn't, the
Processor would raise error.execution and the &lt;assign&gt; would
have no effect.)</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11424" name="N11424" />Example:
Use of the location attribute of the assign to update the salary of
an employee.</div>

<div class="exampleInner">
<pre>
&lt;state id="errorSwitch"&gt;
    &lt;datamodel&gt;
      &lt;data id="employees" src="http://example.com/employees.json"/&gt;
    &lt;/datamodel&gt;
    
    &lt;onentry&gt;
        &lt;assign location="employees.employee[12].salary" expr="42000"/&gt;
    &lt;/onentry&gt;
&lt;/state&gt;
</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="ecma_value_expressions"
name="ecma_value_expressions" />D.2.4 Value Expressions</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> accept any ECMAScript expression as a
value expression.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11433" name="N11433" />Example:
Copying event data into the local data model for the state.</div>

<div class="exampleInner">
<pre>
&lt;state id="processEvent"&gt;
    &lt;datamodel&gt;
        &lt;data id="myEvent"/&gt;
    &lt;/datamodel&gt;
    
    &lt;onentry&gt;
        &lt;assign location="myEvent" expr="_event.data"/&gt;
    &lt;/onentry&gt;
&lt;/state&gt;
</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="ecma_assign" name="ecma_assign" />D.2.5
&lt;assign&gt;</h4>

<p>When evaluating an &lt;assign&gt; element in the ECMA data
model, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> replace the existing value at 'location'
with the value produced by evaluating 'expr'. If it is unable to do
so (for example, if 'location' evaluates to ECMAScript 'null' or
'undefined'), it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the error error.execution on the
internal event queue.</p>
</div>

<div class="div3">
<h4><a id="ecma_system_variables"
name="ecma_system_variables" />D.2.6 System Variables</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> define an ECMAScript read-only variable
for each system variable defined in <a
href="#SystemVariables"><b>5.11 System Variables</b></a>. The
<code>_sessionid</code> and <code>_name</code> system variables are
defined as variables with ECMAScript String values. The
<code>_event</code> system variable is defined as an object with
properties for each of the fields defined in <a
href="#InternalStructureofEvents"><b>5.11.1 The Internal Structure
of Events</b></a>: <code>name</code>,<code>type</code>,
<code>sendid</code>, <code>origin</code>, <code>origintype</code>,
and <code>invokeid</code> are String values, while
<code>data</code> is an Object value.</p>

<p>Suppose as part of executing a state machine named "myName" with
a platform-assigned sessionid "12345", we are processing an event
with the name "foo.bar" and the following object payload:</p>

<div class="exampleOuter">
<pre>
    { "answer" : 42 }

</pre>
</div>

<p>Then the underlying ECMA datamodel would have the following
form:</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N1147A" name="N1147A" />Example:
Illustration of system injected properties</div>

<div class="exampleInner">
<pre>
{
  // The three properties below are automatically populated by the system

  "_name"      : "myName" ,
  "_sessionid" : "12345"  ,
  "_event"     : {
                    "name" : "foo.bar" ,
                    "data" : {
                               "answer"  :  42
                             }
                 } ,

  // Rest of the application / developer-authored data model goes here
}

</pre>
</div>
</div>

<p>As an example, here is a sample transition that accesses the
<code>_event</code> variable in that data model.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11485" name="N11485" />Example:
Accessing system _event name in a condition</div>

<div class="exampleInner">
<pre>
&lt;state id="checkEventName"&gt;
    &lt;transition cond="_event.name=='foo.bar'" target="nextState"&gt;
     ...
    &lt;/transition&gt;
&lt;/state&gt;
</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="ecma_script_module" name="ecma_script_module" />D.2.7
Scripting</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> accept any ECMAScript program as defined
in Section 14 of <a href="#ECMAScript262">[ECMASCRIPT-262]</a> as
the content of a &lt;script&gt; element.</p>
</div>

<div class="div3">
<h4><a id="ecma_foreach" name="ecma_foreach" />D.2.8
&lt;foreach&gt;</h4>

<p>In the ECMA data model, the 'array' value expression <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em>
evaluate to an ECMAScript array (i.e. the result of the expression
<em title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em>
satisfy instanceof(Array) in ECMAScript). The 'item' attribute <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em>
specify a legal ECMAScript variable name. The iteration order is
the order of the underlying ECMAScript array, and goes from an
index of 0 by increments of one to an index of array_name.length -
1. Note that since shallow copy is required &lt;foreach&gt;
assignment is equivalent to item = array_name[index] in ECMAScript.
Note also that the assigned value could be undefined for a sparse
array.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N114A6" name="N114A6" />Example:
Logging ISBN of all books in bookstore shopping cart</div>

<div class="exampleInner">
<pre>
&lt;foreach collection="cart.books" item="book"&gt;
&lt;log expr="'Cart contains book with ISBN ' + book.isbn"/&gt;
&lt;/foreach&gt;
</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="N114AC" name="N114AC" />D.2.9 Unsupported Elements</h4>

<p><a href="#validate"><b>5.5 &lt;validate&gt;</b></a> is not
supported in the ECMA Data Model. If the SCXML processor encounters
a document specifying the ECMA Data Model and containing this
element, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> behave as instructed by the 'exmode'
attribute on &lt;scxml&gt;. See <a href="#scxml"><b>3.2
&lt;scxml&gt;</b></a> for details.</p>
</div>
</div>

<div class="div2">
<h3><a id="xpath-profile" name="xpath-profile" />D.3 The XPath Data
Model</h3>

<p>The value "xpath" for the 'datamodel' attribute results in an
XML data model with XPath used as the expression language.
Implementations that support this data model <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> support
<a href="#XPATH2">[XPath 2.0]</a>.</p>

<div class="div3">
<h4><a id="xpath-datamodel" name="xpath-datamodel" />D.3.1 Data
Model</h4>

<p>For each &lt;data&gt; element in the document, the SCXML
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> create an XPath variable whose name is
the value of the 'id' attribute of the element. Note that the value
of the variable can be assigned in one of the following three
ways:</p>

<ul>
<li>by means of the 'expr' attribute</li>

<li>by means of a resource referenced by the 'src' attribute</li>

<li>by means of inline content</li>
</ul>

<p>If no value is assigned, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> assign
the variable the default value as the following DOM node:</p>

<div class="exampleOuter">
<pre>
&lt;data xmlns=""&gt;&lt;/data&gt;
</pre>
</div>

<p>Note that the assignment takes place at the time indicated by
the 'binding' attribute on the &lt;scxml&gt; element.</p>

<p>The Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place all variables in a single global
XPath scope, such that they are subsequently available to all
expressions within the document.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N114E5" name="N114E5" />Example:
Syntax for XPath datamodel initialization</div>

<div class="exampleInner">
<pre>
&lt;scxml version="1.0" datamodel="xpath"&gt;
&lt;datamodel&gt;
  &lt;data id="company"&gt;
    &lt;about xmlns=""&gt;
      &lt;name&gt;Example company&lt;/name&gt;
      &lt;website&gt;example.com&lt;/website&gt;
      &lt;CEO&gt;John Doe&lt;/CEO&gt;
    &lt;/about&gt;
  &lt;/data&gt;
  &lt;data id="employees" src="http://example.com/employees.xml"/&gt;
  &lt;data id="defaultdata"/&gt;
&lt;/datamodel&gt;
&lt;/scxml&gt;
</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="N114EB" name="N114EB" />D.3.2 Conditional
Expressions</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> accept any XPath 2.0 expression as a
conditional expression and <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> convert it into its effective boolean
value as described in section 2.4.3 of the <a href="#XPATH2">[XPath
2.0]</a> specification. The following example illustrates this
usage.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N114F9" name="N114F9" />Example:
Use of a boolean expression to determine whether or not a
transition is taken.</div>

<div class="exampleInner">
<pre>
&lt;state id="errorSwitch" xmlns:fn="http://www.w3.org/2005/xpath-functions"&gt;
  &lt;datamodel&gt;
    &lt;data id="time"/&gt;
  &lt;/datamodel&gt;
          
  &lt;onentry&gt;
    &lt;assign location="$time" expr="fn:current-dateTime()"/&gt;
  &lt;/onentry&gt;
          
  &lt;transition cond="fn:year-from-dateTime($time) &gt; 2009" target="newBehavior"/&gt;
  &lt;transition target="currentBehavior"/&gt;
&lt;/state&gt;
       
</pre>
</div>
</div>

<p>The SCXML processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> add an XPath function to the SCXML
namespace that takes a stateID as its argument and returns 'true'
if that state is in the current state configuration, as described
in <a href="#ConditionalExpressions"><b>5.10.1 Conditional
Expressions</b></a>. For examples of the use of this predicate (but
in an ECMAScript context), see <a href="#MicrowaveParallel"><b>G.3
Microwave Example (Using parallel)</b></a>.</p>

<div class="exampleOuter">
<p>Function signature: <code>In($stateID as xs:string?) as
xs:boolean</code></p>

<p>Returns an <code>xs:boolean</code> indicating whether or not the
state with ID $stateID is one of the currently active states.</p>
</div>
</div>

<div class="div3">
<h4><a id="N11514" name="N11514" />D.3.3 Location Expressions</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> accept any XPath 2.0 expression as a
location expression. The following example illustrates this
usage:</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N1151C" name="N1151C" />Example:
Use of the location attribute of the assign to update the count for
both Boston and New York.</div>

<div class="exampleInner">
<pre>
&lt;state id="errorSwitch"&gt;
  &lt;datamodel&gt;
    &lt;data id="cities"&gt;
      &lt;list xmlns=""&gt;
        &lt;city id="nyc" count="0"&gt;New York&lt;/city&gt;
        &lt;city id="bos" count="0"&gt;Boston&lt;/city&gt;
      &lt;/list&gt;
    &lt;/data&gt;
  &lt;/datamodel&gt;

  &lt;onentry&gt;
    &lt;assign location="$cities/list/city[@id='nyc']/@count" expr="1"/&gt;
  &lt;/onentry&gt;
&lt;/state&gt;
</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="N11522" name="N11522" />D.3.4 Value Expressions</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> allow any XPath expression to be used as
a value expression. If the result of the value expression is a
node-set, the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> make a deep copy of the subtree rooted at
each node.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N1152D" name="N1152D" />Example:
Copying event data into the local data model for the state.</div>

<div class="exampleInner">
<pre>
&lt;state id="processEvent"&gt;
  &lt;datamodel&gt;
    &lt;data id="myEventData"/&gt;
  &lt;/datamodel&gt;
    
  &lt;onentry&gt;
    &lt;assign location="$myEventData" expr="$_event/data"/&gt;
  &lt;/onentry&gt;
&lt;/state&gt;
</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="xpath_assign" name="xpath_assign" />D.3.5
&lt;assign&gt;</h4>

<p>Implementations supporting the XPath datamdel <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> support
the following additional attributes for the &lt;assign&gt;
element.</p>

<table border="1" summary="attibute table">
<tbody>
<tr>
<th>Name</th>
<th>Required</th>
<th>Attribute Constraints</th>
<th>Type</th>
<th>Default Value</th>
<th>Valid Values</th>
<th>Description</th>
</tr>

<tr>
<td>type</td>
<td>false</td>
<td />
<td>enum</td>
<td>replacechildren</td>
<td>replacechildren, firstchild, lastchild, previoussibling,
nextsibling, replace, delete, addattribute</td>
<td>Defines the nature of the insertion to be performed. See below
for details.</td>
</tr>

<tr>
<td>attr</td>
<td>false</td>
<td>This attribute must be present if and only if 'type' is
'addattribute'.</td>
<td>NMTOKEN</td>
<td>none</td>
<td></td>
<td>The attribute name to add at the specified location.</td>
</tr>
</tbody>
</table>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> modify the datamodel as directed by the
'type' attribute as described below. If it is unable to do so, it
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em> place
the error error.execution on the internal event queue:</p>

<ul>
<li>replacechildren. All the children at 'location' are replaced
with the value specified by 'expr'.</li>

<li>firstchild. The value specified by 'expr' is inserted before
all of the children at 'location'.</li>

<li>lastchild. The value specified by 'expr' is inserted after all
of the children at 'location'.</li>

<li>previoussibling. The value specified by 'expr' is inserted
before the node specified by 'location', keeping the same
parent.</li>

<li>nextsibling. The value specified by 'expr' is inserted after
the node specified by 'location', keeping the same parent.</li>

<li>replace. The node specified by 'location' is replaced by the
value specified by 'expr'.</li>

<li>delete. The node specified by 'location' is deleted. 'expr' is
ignored.</li>

<li>addattribute. An attribute with the name specified by 'attr'
and value specified by 'expr' is added to the node specified by
'location'.</li>
</ul>

<p>Note that in the case of an XML data model, it is not required
to assign to the root of a tree (i.e., the "name" value in a
&lt;data&gt; tag), since the path expression can reach down into
the tree to assign a new value to an internal node. The following
examples show various aspects of assignment in the XPath data
model. Suppose we have a data model of the following form:</p>

<div class="exampleOuter">
<pre>
&lt;data id="cart"&gt;
  &lt;myCart xmlns=""&gt;
    &lt;books&gt;
      &lt;book&gt;
        &lt;title&gt;The Zen Mind&lt;/title&gt;
      &lt;/book&gt;
      &lt;book&gt;
        &lt;title&gt;Freakonomics&lt;/title&gt;
      &lt;/book&gt;
    &lt;/books&gt;
    &lt;cds&gt;
      &lt;cd name="Something"/&gt;
    &lt;/cds&gt;
  &lt;/myCart&gt;
&lt;/data&gt;
</pre>
</div>

<p>Here is an example of assignment of a string to an element
node.</p>

<div class="exampleOuter">
<pre>
 
&lt;assign location="$cart/myCart/books/book[1]/title"  expr="'My favorite book'"/&gt;
</pre>
</div>

<p>results in</p>

<div class="exampleOuter">
<pre>
&lt;data id="cart"&gt;
  &lt;myCart xmlns=""&gt;
    &lt;books&gt;
      &lt;book&gt;
        &lt;title&gt;My favorite book&lt;/title&gt;
      &lt;/book&gt;
      &lt;book&gt;
        &lt;title&gt;Freakonomics&lt;/title&gt;
      &lt;/book&gt;
      ...
&lt;/data&gt;
</pre>
</div>

<p>Now suppose we assign an xml structure to an element node. The
following assignment statement would have the effect of replacing
the children of the element "$cart/myCart/books/book[1]" by the XML
tree rooted in &lt;bookinfo&gt;.</p>

<div class="exampleOuter">
<pre>
&lt;assign location="$cart/myCart/books/book[0]"&gt;
  &lt;bookinfo xmlns=""&gt;
    &lt;isdn&gt;12334455&lt;/isdn&gt;
    &lt;author&gt;some author&lt;/author&gt;
  &lt;/bookinfo&gt;
&lt;/assign&gt;
</pre>
</div>

<p>results in</p>

<div class="exampleOuter">
<pre>
&lt;data id="cart"&gt;
  &lt;myCart xmlns=""&gt;
    &lt;books&gt;
      &lt;book&gt;
        &lt;bookinfo&gt;
          &lt;isdn&gt;12334455&lt;/isdn&gt;
          &lt;author&gt;some author&lt;/author&gt;
        &lt;/bookinfo&gt;
      &lt;/book&gt;
      &lt;book&gt;
        &lt;title&gt;Freakonomics&lt;/title&gt;
      &lt;/book&gt;
      ...
&lt;/data&gt;
</pre>
</div>

<p>Here are examples of legal and illegal assignment to an
attribute:</p>

<div class="exampleOuter">
<pre>
&lt;!-- Legal assignment: --&gt;
&lt;assign location="$cart/myCart/cds/cd/@name" expr"'Something Else'"/&gt;

&lt;!-- Illegal assignment: --&gt;
&lt;assign  location="$cart/myCart/cds/cd/@name" &gt;
  &lt;foo&gt;
    &lt;bar/&gt;
  &lt;/foo&gt;
&lt;/assign&gt;
</pre>
</div>

<p>Now suppose we assign a string to a nodeset. The following
assignment statement would have the effect of replacing the
children of each node in the nodeset $cart/myCart/books/book with
the string "The Zen Mind":</p>

<div class="exampleOuter">
<pre>
&lt;assign location="$cart/myCart/books/book" expr="'The Zen Mind'"/&gt;
</pre>
</div>

<p>results in</p>

<div class="exampleOuter">
<pre>
&lt;data id="cart"&gt;
  &lt;myCart xmlns=""&gt;
    &lt;books&gt;
      &lt;book&gt;The Zen Mind&lt;/book&gt;
      &lt;book&gt;The Zen Mind&lt;/book&gt;
    &lt;/books&gt;
    ...
&lt;/data&gt;
</pre>
</div>

<p>Finally suppose we assign a structure to a nodeset. The
following statement would iterate over the elements in the nodeset
of &lt;book&gt; elements and replace their children with the
&lt;price&gt; structure:</p>

<div class="exampleOuter">
<pre>
&lt;assign location="$cart/myCart/books/book"&gt;
  &lt;price&gt;20.0&lt;/price&gt;
&lt;/assign&gt;
</pre>
</div>

<p>results in</p>

<div class="exampleOuter">
<pre>
&lt;data id="cart"&gt;
  &lt;myCart xmlns=""&gt;
    &lt;books&gt;
      &lt;book&gt;
        &lt;price&gt;20.0&lt;/price&gt;
      &lt;/book&gt;
      &lt;book&gt;
        &lt;price&gt;20.0&lt;/price&gt;
      &lt;/book&gt;
    &lt;/books&gt;
    ...
&lt;/data&gt;
</pre>
</div>

<p>If the evaluation of any of the expressions in an &lt;assign&gt;
element causes an error to be raised, evaluation of the element
terminates immediately and the &lt;assign&gt; has no effect. For
example, the following assignment statement would raise an error
because the sample datamodel we are using does not have an
&lt;ISBN&gt; node as a child of &lt;book&gt;:</p>

<div class="exampleOuter">
<pre>
 
&lt;assign location="$cart/myCart/books/book[1]/ISBN"  expr="'....'"/&gt;
</pre>
</div>
</div>

<div class="div3">
<h4><a id="N115C9" name="N115C9" />D.3.6 System Variables</h4>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> create an implicit &lt;data&gt; element
for each system variable defined in <a
href="#SystemVariables"><b>5.11 System Variables</b></a>.</p>

<p>Suppose as part of executing a state machine named "myName" with
a platform-assigned sessionid "12345", we are processing an event
with the name "foo.bar" and the following XML payload:</p>

<div class="exampleOuter">
<pre>
&lt;payload xmlns=""&gt;
    &lt;answer&gt;42&lt;/answer&gt;
&lt;/payload&gt;
</pre>
</div>

<p>Then the underlying XML datamodel would have the following
form:</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N115DC" name="N115DC" />Example:
Illustration of system injected data</div>

<div class="exampleInner">
<pre>
  &lt;datamodel&gt;

    &lt;!-- The three data elements below are automatically populated by the system --&gt;

    &lt;data id="_name"&gt;myName&lt;/data&gt;
    &lt;data id="_sessionid"&gt;12345&lt;/data&gt;
    &lt;data id="_event"&gt;
      &lt;name xmlns=""&gt;foo.bar&lt;/name&gt;
      &lt;data xmlns=""&gt;
        &lt;payload&gt;
          &lt;answer&gt;42&lt;/answer&gt;
        &lt;/payload&gt;
      &lt;/data&gt;
    &lt;/data&gt;

    &lt;!-- Rest of the application / developer-authored
         data model goes here --&gt;

  &lt;/datamodel&gt;
</pre>
</div>
</div>

<p>As an example, here is a sample transition that accesses the
<code>$_sessionid</code> variable in that data model.</p>

<div class="exampleOuter">
<pre>
&lt;state id="checkSessionid"&gt;
  &lt;transition cond="$_sessionid = '12345'" target="nextState"/&gt;
  ...
&lt;/state&gt;
</pre>
</div>
</div>

<div class="div3">
<h4><a id="N115EB" name="N115EB" />D.3.7 Scripting</h4>

<p>There is no scripting language.</p>
</div>

<div class="div3">
<h4><a id="XML_foreach" name="XML_foreach" />D.3.8
&lt;foreach&gt;</h4>

<p>In the XPath data model, the 'array' value expression <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em>
evaluate to an Node-set The 'item' attribute <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em>
specify a legal XPath variable name. The iteration order is the
order of the underlying Node-set, and goes from an index of 1 by
increments of one to an index of count(node-set).</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N115FC" name="N115FC" />Example:
Logging ISBN of all books in bookstore shopping cart</div>

<div class="exampleInner">
<pre>
&lt;foreach collection="$cart/books" item="book"&gt;
&lt;log expr="'Cart contains book with ISBN ' + $book/isbn"/&gt;
&lt;/foreach&gt;

</pre>
</div>
</div>
</div>

<div class="div3">
<h4><a id="N11602" name="N11602" />D.3.9 Unsupported Elements</h4>

<p><a href="#script"><b>5.9 &lt;script&gt;</b></a> is not supported
in the XPath Data Model. If the SCXML processor encounters a
document specifying the XPath Data Model and containing this
element, it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> behave as instructed by the 'exmode'
attribute on &lt;scxml&gt;. See <a href="#scxml"><b>3.2
&lt;scxml&gt;</b></a> for details.</p>
</div>
</div>
</div>

<div class="div1">
<h2><a id="eventioprocessors" name="eventioprocessors" />E Event
I/O Processors</h2>

<div class="div2">
<h3><a id="SCXMLEventProcessor" name="SCXMLEventProcessor" />E.1
SCXML Event I/O Processor</h3>

<p>The SCXML Event I/O Processor is intended to transport messages
in a specific format to and from SCXML sessions. This processor
specifies the schema of the message and how it maps onto SCXML
events, but it does not define the transport mechanism, which is
platform-specific. The schema for the message is available at <a
href="http://www.w3.org/2011/04/SCXML/scxml.xsd">http://www.w3.org/2011/04/SCXML/scxml-message.xsd</a>.
SCXML Processors <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> support sending messages to and receiving
messages from other SCXML sessions using the SCXML Event I/O
Processor. An SCXML Processor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> support exchanging messages with non-SCXML
endpoints using the SCXML Event I/O Processor. However this
specification defines the behavior for SCXML endpoints only.</p>

<p>The contents of the message are defined as follows:</p>

<ol>
<li>'name'. The sending SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> take the
value of this attribute from the 'event' attribute of the
&lt;send&gt; element. The receiving SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use it as
the value the 'name' field in the event that it generates (see <a
href="#InternalStructureofEvents"><b>5.11.1 The Internal Structure
of Events</b></a>).</li>

<li>'source'. The sending SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> populate
this attribute with a URI that the receiving processor can use to
reply to the sending processor. The receiving SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use this
URI as the value of the 'origin' field in the event that it
generates (see <a href="#InternalStructureofEvents"><b>5.11.1 The
Internal Structure of Events</b></a>).</li>

<li>'target'. The sending SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> take the
value of this attribute from the 'target' attribute of the
&lt;send&gt; element. The receiving SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use this
value to determine which session to deliver the message to. See <a
href="#SendTargets"><b>6.2.4 The Target of Send</b></a> for details
on the interpretation of this identifier.</li>

<li>'sendid'. the sending SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> populate
this attribute with the identifier specified in the 'id' attribute
or automatically generated by the platform when the &lt;send&gt;
tag is executed in the sending session. (See <a href="#send"><b>6.2
&lt;send&gt;</b></a>.) The receiving SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use this
value as the value of the 'sendid' field in the event that it
generates. If the author of the sending session did not specify
either the 'id' or 'idlocation' attribute, the sending SCXML
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> leave this attribute empty.</li>

<li>'sourcetype'. The sending SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> assign
this attribute the value "scxml". (Note that other types of senders
will assign different values.) The receiving Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use this
value as the value of the 'origintype' field of the event that it
generates.</li>

<li>The 'language' attribute is used to indicate the type of data
contained in the body of the message inside the &lt;payload&gt;
element. The sending SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> populate
this attribute with the value of the 'datamodel' attribute in the
&lt;scxml&gt; element.</li>

<li>&lt;payload&gt;. The sending SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> populate
this element with any data specified in the 'namelist' attribute of
in &lt;param&gt; and &lt;content&gt; elements. It <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> encode
the data in the language indicated by the 'language' attribute, for
example XML or JSON. This data <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> be in any namespace, or in no namespace at
all. The receiving SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> use this
value to populate the '_data' field of the event that it
generates.</li>
</ol>

<p>Here is a summary of the mapping between &lt;send&gt;, the SCXML
message structure, and the event that is raised in the receiving
session.</p>

<table border="1" cellpadding="2" cellspacing="2"
summary="send type values" width="100%">
<tbody>
<tr>
<th align="center">&lt;send&gt; element</th>
<th align="center">SCXML Message Structure</th>
<th align="center">Target Session Event</th>
</tr>

<tr>
<td align="left">'event' attribute</td>
<td align="left">'name' attribute</td>
<td align="left">'name' field</td>
</tr>

<tr>
<td align="left">not present in &lt;send&gt; but known to
platform</td>
<td align="left">'source' attribute</td>
<td align="left">'origin' field</td>
</tr>

<tr>
<td align="left">'target' attribute</td>
<td align="left">'target' attribute</td>
<td align="left">not present</td>
</tr>

<tr>
<td align="left">literal provided by author or value generated by
platform</td>
<td align="left">'sendid' attribute</td>
<td align="left">'sendid' field</td>
</tr>

<tr>
<td align="left">not present</td>
<td align="left">'sourcetype' attribute. Always "scxml".</td>
<td align="left">'origintype' field. Always "scxml".</td>
</tr>

<tr>
<td align="left">not present</td>
<td align="left">'language' attribute.</td>
<td align="left">not present</td>
</tr>

<tr>
<td align="left">'namelist' attribute, &lt;content&gt; child, or
&lt;param&gt; children</td>
<td align="left">&lt;payload&gt; element</td>
<td align="left">data field</td>
</tr>
</tbody>
</table>

<p>When an SCXML Processor receives a message via the SCXML Event
I/O Processor it <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> validate the syntax of the incoming
message and check that it matches an active session. If the message
fails syntactic validation or does not match an active session, the
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> notify the sending processor of the error
and <em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
ignore the message. If the message passes validation, but the
receiving Processor cannot handle the data format contained in the
message, the receiving Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error error.communication in internal queue of the session for
which the message was intended and <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> ignore
the message. The Processor <em title="SHOULD in RFC2119 context"
class="RFC2119">SHOULD</em> also notify the sending endpoint of the
error. If no errors occur, the receiving Processor <em
title="CONVERT in RFC2119 context" class="RFC2119">CONVERT</em> the
message into an SCXML event, using the mapping defined above, and
<em title="CONVERT in RFC2119 context" class="RFC2119">CONVERT</em>
insert the event its external event queue.</p>

<p>If the sending entity is an SCXML session, it <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em> also
report errors. For example, if the sending session specifies a
sessionid that does not exist on the receiving system, specifies a
data format that the receiving session does not support, or is
unable to connect to the receiving system, it <em
title="SHOULD in RFC2119 context" class="RFC2119">SHOULD</em> place
the error error.communication on the internal event queue.</p>

<p>If the current session was triggered by an instance of
&lt;invoke&gt;, the SCXML Event I/O Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> handle
the 'cancel.invoke.<em>id</em>' event as defined in <a
href="#invokeimplementation"><b>6.4.3 Implementation of
&lt;invoke&gt;</b></a>. In other cases (namely if the current
session was not triggered by an instance of &lt;invoke&gt; or if
the <em>id</em> does not match the invokeid of the triggering
&lt;invoke&gt; element), the SCXML Event I/O processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> discard
the event and <em title=" SHOULD in RFC2119 context"
class="RFC2119">SHOULD</em> signal an error.</p>

<div class="div3">
<h4><a id="N1172F" name="N1172F" />E.1.1 Examples</h4>

<p>Here are some examples of SCXML messages sent between SCXML
sessions. Each example shows the original &lt;send&gt; element, the
corresponding &lt;message&gt; structures and a transition handling
the resulting event in the receiving SCXML session.</p>

<p><em>EXAMPLE 1:</em> First, here is a message with an XML payload
generated by &lt;send&gt; with a 'namelist':</p>

<div class="exampleInner">
<pre>
SESSION1 : SENDING SESSION
Pattern: "event" attribute with an optional "namelist"

&lt;datamodel&gt;
  &lt;data id="email" expr="'mailto:recipient@example.com'"/&gt;
  &lt;data id="content" expr="'http://www.example.com/mycontent.txt'"/&gt;
  &lt;data id="xmlcontent"&gt;
    &lt;headers xmlns="http://www.example.com/headers"&gt;
      &lt;cc&gt;archive@example.com&lt;/cc&gt;
      &lt;subject&gt;Example email&lt;/subject&gt;
    &lt;/headers&gt;
  &lt;/data&gt;
&lt;/datamodel&gt;

  ...

&lt;send id="send-123"
      target="http://scxml-processors.example.com/session2"
      type="scxml" event="email.send"
      namelist="email content xmlcontent"/&gt;


</pre>
</div>

<p>Here is the actual XML message that will be sent over
platform-specific transport and converted into an event in the
target SCXML session:</p>

<div class="exampleInner">
<pre>
&lt;scxml:message xmlns:scxml="http://www.w3.org/2005/07/scxml" version="1.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.w3.org/2005/07/scxml scxml-message.xsd"
       source="http://scxml-processors.example.com/session1" sourcetype="scxml"
       target="http://scxml-processors.example.com/session2" type="scxml"
       sendid="send-123" name="email.send"&gt;
  &lt;scxml:payload&gt;
    &lt;scxml:property name="email"&gt;mailto:recipient@example.com&lt;/scxml:property&gt;
    &lt;scxml:property name="content"&gt;http://www.example.com/mycontent.txt&lt;/scxml:property&gt;
    &lt;scxml:property name="xmlcontent"&gt;
      &lt;headers xmlns="http://www.example.com/headers"&gt;
        &lt;cc&gt;archive@example.com&lt;/cc&gt;
        &lt;subject&gt;Example email&lt;/subject&gt;
      &lt;/headers&gt;
    &lt;/scxml:property&gt;
    &lt;scxml:hint&gt;Email headers&lt;/scxml:hint&gt;
  &lt;/scxml:payload&gt;
&lt;/scxml:message&gt;
</pre>
</div>

<p>Here is sample SCXML code to process that event in the receiving
SCXML session. In this example &lt;my:email&gt; is
platform-specific executable content that sends an email:</p>

<div class="exampleInner">
<pre>
SESSION2 : RECEIVING SESSION
Pattern: "event" attribute with an optional "namelist"

&lt;scxml:transition event="email.send"&gt;
  &lt;my:email to="data('_event')/scxml:property[@name='email']"
            cc="data('_event')/scxml:property[@name='xmlcontent']/h:headers/h:cc"
            subject="data('_event')/scxml:property[@name='xmlcontent']/h:headers/h:subject"
            content="data('_event')/scxml:property[@name='content']"/&gt;
&lt;/scxml:transition&gt;
</pre>
</div>

<p><em>EXAMPLE 2:</em> The next example shows &lt;send&gt; using
inline XML content:</p>

<div class="exampleInner">
<pre>
SESSION1 : SENDING SESSION
Pattern: "xmlns" attribute with explicit inline content

&lt;send id="send-123"
      target="http://scxml-processors.example.com/session2"
      type="scxml"
      xmlns:csta="http://www.ecma.ch/standards/ecma-323/csta"&gt;

  &lt;content&gt;
     &lt;csta:MakeCall&gt;
       &lt;csta:callingDevice&gt;22343&lt;/callingDevice&gt;
       &lt;csta:calledDirectoryNumber&gt;18005551212&lt;/csta:calledDirectoryNumber&gt;
     &lt;/csta:MakeCall&gt;
  &lt;/content&gt;

&lt;/send&gt;

</pre>
</div>

<p>Here is the actual XML message that will be sent:</p>

<div class="exampleInner">
<pre>
&lt;scxml:message xmlns:scxml="http://www.w3.org/2005/07/scxml" version="1.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.w3.org/2005/07/scxml scxml-message.xsd"
       source="http://scxml-processors.example.com/session1"
       target="http://scxml-processors.example.com/session2"
       sendid="send-123"&gt;
  &lt;scxml:payload xmlns:csta="http://www.ecma.ch/standards/ecma-323/csta"&gt;
    &lt;csta:MakeCall&gt;
      &lt;csta:callingDevice&gt;22343&lt;/csta:callingDevice&gt;
      &lt;csta:calledDirectoryNumber&gt;18005551212&lt;/csta:calledDirectoryNumber&gt;
    &lt;/csta:MakeCall&gt;
  &lt;/scxml:payload&gt;
&lt;/scxml:message&gt;
</pre>
</div>

<p>Here is sample SCXML code to process the resulting event in the
receiving SCXML session. It uses the special executable content
&lt;csta:makecall&gt; to generate a telephone call:</p>

<div class="exampleInner">
<pre>
SESSION2 : RECEIVING SESSION
Pattern: "xmlns" attribute with explicit inline content

&lt;scxml:transition event="external.event"&gt;
  &lt;csta:makecall callingDevice="data('_event')/csta:MakeCall/csta:callingDevice"
                 callingDirectoryNumber="data('_event')/csta:MakeCall/csta:callingDirectoryNumber"/&gt;
&lt;/scxml:transition&gt;
</pre>
</div>

<p><em>EXAMPLE 3:</em> Finally, here is an example generated by
&lt;send&gt; using both 'event' and 'namelist' attributes and using
JSON content:</p>

<div class="exampleInner">
<pre>
SESSION1 : SENDING SESSION
Pattern: "event" attribute with an optional "namelist"

&lt;datamodel&gt;
  &lt;data id="email" expr="'mailto:recipient@example.com'"/&gt;
  &lt;data id="content" expr="'http://www.example.com/mycontent.txt'"/&gt;
  &lt;data id="jsoncontent" src="http://www.example.com/headers.json"/&gt;
&lt;/datamodel&gt;

  ...

&lt;send sendid="send-123"
      target="'http://scxml-processors.example.com/session2'"
      type="'scxml'" event="'email.send'"
      namelist="email content jsoncontent"/&gt;

</pre>
</div>

<p>Here is the actual XML message that will be sent over
platform-specific transport and converted into an event in the
target SCXML session:</p>

<div class="exampleInner">
<pre>
&lt;scxml:message xmlns:scxml="http://www.w3.org/2005/07/scxml" version="1.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.w3.org/2005/07/scxml scxml-message.xsd"
       source="http://scxml-processors.example.com/session1"
       target="http://scxml-processors.example.com/session2"
       sendid="send-123" name="email.send" language="json"&gt;
  &lt;scxml:payload&gt;
    &lt;scxml:property name="email"&gt;mailto:recipient@example.com&lt;/scxml:property&gt;
    &lt;scxml:property name="content"&gt;http://www.example.com/mycontent.txt&lt;/scxml:property&gt;
    &lt;scxml:property name="jsoncontent"&gt;
      &lt;![CDATA[
        headers : {
          cc  : "audit@example.com" ,
          subject : "Example email"
        }
      ]]&gt;
    &lt;/scxml:property&gt;
    &lt;scxml:hint&gt;Email headers&lt;/scxml:hint&gt;
  &lt;/scxml:payload&gt;
&lt;/scxml:message&gt;
</pre>
</div>

<p>Here is sample SCXML code to process the resulting event in the
receiving SCXML session. In this example, &lt;my:email&gt; is
special executable content as in the first example.</p>

<div class="exampleInner">
<pre>
SESSION2 : RECEIVING SESSION
Pattern: "event" attribute with an optional "namelist"

&lt;scxml:transition event="email.send"&gt;
  &lt;my:email to="_event.email"
            cc="_event.jsoncontent.headers.cc"
            subject="_event.jsoncontent.headers.subject"
            content="_event.content"/&gt;
&lt;/scxml:transition&gt;
</pre>
</div>
</div>

<p>In some cases it may be convenient to included multiple
&lt;message&gt; structures in a single payload. The following
schema defines a &lt;messages&gt; element which contains multiple
&lt;message&gt; elements. Support for this schema is optional.</p>

<p>scxml-messages.xsd</p>

<div class="exampleInner">
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!--
    XML Schema for sending messages to SCXML processors.
--&gt;
&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.w3.org/2005/07/scxml"
    xmlns="http://www.w3.org/2005/07/scxml"
    elementFormDefault="qualified"&gt;

    &lt;xsd:include schemaLocation="scxml-message.xsd"/&gt;

    &lt;xsd:annotation&gt;
        &lt;xsd:documentation xml:lang="en"&gt;
            XML Schema for sending messages to SCXML processors.
            Version 1.0
        &lt;/xsd:documentation&gt;
        &lt;xsd:documentation source="scxml-copyright.xsd" /&gt;
    &lt;/xsd:annotation&gt;

    &lt;xsd:attributeGroup name="scxmlmessages.extra.attribs"&gt;
        &lt;xsd:annotation&gt;
            &lt;xsd:documentation&gt;
                Group allowing attributes from other namespaces
            &lt;/xsd:documentation&gt;
        &lt;/xsd:annotation&gt;
        &lt;xsd:anyAttribute namespace="##other" processContents="lax" /&gt;
    &lt;/xsd:attributeGroup&gt;

    &lt;xsd:attributeGroup name="scxmlmessages.messages.attlist"&gt;
        &lt;xsd:attribute name="version" type="xsd:string" fixed="1.0"
            use="required" /&gt;
        &lt;xsd:attributeGroup ref="scxmlmessages.extra.attribs" /&gt;
    &lt;/xsd:attributeGroup&gt;

    &lt;xsd:group name="scxmlmessages.messages.content"&gt;
        &lt;xsd:sequence&gt;
            &lt;xsd:element ref="message" minOccurs="1"
                maxOccurs="unbounded" /&gt;
        &lt;/xsd:sequence&gt;
    &lt;/xsd:group&gt;

    &lt;xsd:complexType name="scxmlmessages.messages.type"&gt;
        &lt;xsd:group ref="scxmlmessages.messages.content" /&gt;
        &lt;xsd:attributeGroup ref="scxmlmessages.messages.attlist" /&gt;
    &lt;/xsd:complexType&gt;

    &lt;xsd:element name="messages" type="scxmlmessages.messages.type" /&gt;

&lt;/xsd:schema&gt;
</pre>
</div>
</div>

<div class="div2">
<h3><a id="BasicHTTPEventProcessor"
name="BasicHTTPEventProcessor" />E.2 Basic HTTP Event I/O
Processor</h3>

<p>The Basic HTTP Event I/O Processor is intended as a minimal
interoperable mechanism for sending and receiving events between
external components and SCXML 1.0 implementations. Support for the
Basic HTTP Event I/O Processor is optional, but implementations
that implement this processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> support sending and receiving messages in
the SCXML message format using it(<a
href="http://www.w3.org/2011/04/SCXML/scxml.xsd">http://www.w3.org/2011/04/SCXML/scxml-message.xsd</a>).</p>

<div class="div3">
<h4><a id="accessURI" name="accessURI" />E.2.1 Access URI</h4>

<p>The access URI for the Basic HTTP Event I/O Processor is the URI
to which an external component can send an event for injection into
an active session.</p>

<p>The access URI is available via the system variable
_ioprocessors using the key "basichttp". For example, in <a
href="#ecma-profile"><b>D.2 The ECMAScript Data Model</b></a>,
_ioprocessors["basichttp"] returns the access URI (e.g.
http://www.example.com/scxml/basichttp) for the basichttp
processor.</p>

<p>The access URI may also be specified in an
implementation-specific manner (for example, product
documentation).</p>
</div>

<div class="div3">
<h4><a id="N11789" name="N11789" />E.2.2 Receiving Events</h4>

<p>An SCXML Processor that supports the Basic HTTP Event I/O
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> accept messages from external components
the access URI as HTTP POST requests (see <a
href="#HTTP">[HTTP]</a>). The SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> validate
the message it receiveds and then <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> build the
appropriate SCXML event and <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> add it to the appropriate event
queue.</p>

<p>If the HTTP parameter '_content' is present, the SCXML Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
interpret its value as a message in the SCXML message format (<a
href="http://www.w3.org/2011/04/SCXML/scxml.xsd">http://www.w3.org/2011/04/SCXML/scxml-message.xsd</a>).
The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> map such a message to an SCXML event as
described in <a href="#SCXMLEventProcessor"><b>E.1 SCXML Event I/O
Processor</b></a>. An SCXML Processor <em
title="MAY in RFC2119 context" class="RFC2119">MAY</em> accept
other parameters as well. In such cases, the mapping of their
values to SCXML events is implementation-specific.</p>

<p>After it adds the received message to the appropriate event
queue, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> then indicate the result to the external
component via a success response code 2XX. Note that this response
is sent before the event is removed from the queue and processed.
In the cases where the message cannot be formed into an SCXML
event, the Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> return an HTTP error code as defined in
<a href="#HTTP">[HTTP]</a>. The following codes are assigned a more
specific meaning in the SCXML context:</p>

<ul>
<li>400 (Bad Request). Message structure is invalid.</li>

<li>403 (Forbidden). Session id does not match an existing SCXML
session id.</li>
</ul>
</div>

<div class="div3">
<h4><a id="N117BF" name="N117BF" />E.2.3 Sending Events</h4>

<p>Events can be sent from the SCXML implementation to an external
component with the Basic HTTP Event I/O Processor using the
&lt;send&gt; element (see <a href="#send"><b>6.2
&lt;send&gt;</b></a>) with the type attribute set to "basichttp"
and the target attribute set to the access URI of the external
component.</p>

<p>The SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> attempt deliver the message using HTTP
method "POST" and with parameter values encoded by default in an
application/x-www-form-urlencoded body (POST method). An SCXML
Processor <em title="MAY in RFC2119 context"
class="RFC2119">MAY</em> support other encodings, and allow then to
be specified in a platform-specific way.</p>

<p>If the namelist attribute is defined, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> map its
variable names and values to HTTP parameters. If one or more
&lt;param&gt; children are present, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> map their
names (i.e. name attributes) and values to HTTP parameters. If a
&lt;content&gt; child is present, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> map its
value to the distinguished HTTP parameter '_content'.</p>

<p>If the external component returns any HTTP response code other
than 2XX, the SCXML Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> place the error error.communication on
the internal event queue of the session that attempted to send the
event.</p>
</div>
</div>

<div class="div2">
<h3><a id="DOMEventProcessor" name="DOMEventProcessor" />E.3 DOM
Event I/O Processor</h3>

<p>The DOM Event I/O processor handles communication between SCXML
markup and markup in other namespaces in mixed-markup XML
documents. An example of this would be a document containing both
SCXML and HTML markup. In such a case, each language retains its
own context and its own independent semantics. (For example,
SCXML's event processing algorithm is not affected by the fact that
there is HTML markup elsewhere in the document.) It is however
useful for the two languages to be able to communicate by sending
events back and forth, so that the HTML markup can notify SCXML
when the user clicks on a button, and the SCXML markup can notify
HTML when it is time to place a certain field in focus, etc. The
DOM Event I/O processor handles this communication by means of DOM
Events <a href="#DOMEvents">[DOMEvents]</a>, which are a general
means for information propagation in XML documents.</p>

<div class="div3">
<h4><a id="N117E8" name="N117E8" />E.3.1 Sending Events</h4>

<p>The SCXML author can send a DOM event to any node in the
document by selecting the DOM Event I/O processor (type="DOM") and
specifying the URI of that node as the target. The SCXML Processor
<em title="MUST in RFC2119 context" class="RFC2119">MUST</em>
populate the attributes of the event with the values specified via
"namelist" or &lt;param&gt;. "namelist" or &lt;param&gt;. The
Processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> ignore items that do not correspond to
attributes of the event. If the URI specified is not part of the
same document, the SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> place the
error error.communication in the internal event queue.</p>
</div>

<div class="div3">
<h4><a id="N117F6" name="N117F6" />E.3.2 Receiving Events</h4>

<p>When a DOM event is targeted at the &lt;scxml&gt; root node, the
DOM Event I/O processor <em title="MUST in RFC2119 context"
class="RFC2119">MUST</em> convert it into an SCXML event and insert
it in the external event queue. It <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> convert
the attributes of the DOM event into like-named elements in the
data field of the event (see <a
href="#InternalStructureofEvents"><b>5.11.1 The Internal Structure
of Events</b></a> for details.) The SCXML Processor <em
title="MUST in RFC2119 context" class="RFC2119">MUST</em> ignore
DOM events targeted at other nodes in the SCXML markup.</p>
</div>
</div>
</div>

<div class="div1">
<h2><a id="relatedWork" name="relatedWork" />F Related Work</h2>

<p>A number of other XML-based state machine notations have been
developed, but none serves the same purpose as SCXML. XMI <a
href="#XMI">[UML XMI]</a> is a notation developed for representing
UML diagrams, including Harel State charts. However it is intended
as a machine interchange format and is not readily authorable by
humans. ebXML <a href="#ebXML">[OASIS ebXML]</a> is a language for
business process specification intended to support B2B e-commerce
applications. It contains a state machine language that is in some
ways similar to the one presented here, but its syntax and
semantics are closely tied to its intended use in e-commerce. It is
therefore not suitable as a general-purpose state machine language.
XTND <a href="#XTND">[XTND]</a>, also called XML Transition Network
Definition, is a notation for simple finite state machines but
lacks Harel's notions of hierarchical and parallel states and are
thus not suitable for a general-purpose state machine that is
semantically equivalent to Harel statecharts.</p>
</div>

<div class="div1">
<p>This section is informative.</p>

<h2><a id="Examples" name="Examples" />G Examples</h2>

<div class="div2">
<h3><a id="N1181C" name="N1181C" />G.1 Language Overview</h3>

<p>This SCXML document gives an overview of the SCXML language and
shows the use of its state machine transition flows:</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11821" name="N11821" />Example:
Main.scxml</div>

<div class="exampleInner">
<pre>
&lt;?xml version="1.0" encoding="us-ascii"?&gt;
&lt;!-- A wrapper state that contains all other states in this file
- it represents the complete state machine --&gt; 
&lt;scxml xmlns="http://www.w3.org/2005/07/scxml"
       version="1.0"
       initial="Main"
       datamodel="ecmascript"&gt;
  &lt;state id="Main"&gt;
    &lt;!-- its initial state is Test1 --&gt;
    &lt;initial&gt;
      &lt;transition target="Test1"/&gt;
    &lt;/initial&gt;

    &lt;!-- Really simple state showing the basic syntax. --&gt;
    &lt;state id="Test1"&gt;
      &lt;initial&gt;
        &lt;transition target="Test1Sub1"/&gt;
      &lt;/initial&gt;
      &lt;!-- Runs before we go into the substate --&gt;
      &lt;onentry&gt; 
        &lt;log expr="'Inside Test1'"/&gt;
      &lt;/onentry&gt;

      &lt;!-- Here is our first substate --&gt;
      &lt;state id="Test1Sub1"&gt;
        &lt;onentry&gt;
          &lt;log expr="'Inside Test1Sub1.'"/&gt;
        &lt;/onentry&gt;
        &lt;onexit&gt;
          &lt;log expr="'Leaving Test1Sub1'"/&gt;
        &lt;/onexit&gt;
        &lt;!-- Go to Sub2 on Event1 --&gt;
        &lt;transition event="Event1" target="Test1Sub2"/&gt;
      &lt;/state&gt;

      &lt;!-- Here is the second substate 
           It is final, so Test1 is done when we get here --&gt;
      &lt;final id="Test1Sub2"/&gt;

      &lt;!-- We get this event when we reach Test1Sub2. --&gt;
      &lt;transition event="Test1.done" target="Test2"/&gt;

      &lt;!-- We run this on the way out of Test1 --&gt;
      &lt;onexit&gt;
        &lt;log expr="'Leaving Test1...'"/&gt;
      &lt;/onexit&gt;
    &lt;/state&gt;

    &lt;state id="Test2"&gt;
      &lt;initial&gt;
        &lt;transition target="Test2Sub1"/&gt;
      &lt;/initial&gt;

      &lt;!-- This time we reference a state 
           defined in an external file.   --&gt;
       &lt;xi:include href="SCXMLExamples/Test2Sub1.xml" parse="text"/&gt;
  
      &lt;final id="Test2Sub2"/&gt;

      &lt;!-- Test2Sub2 is defined as final, so this
           event is generated when we reach it --&gt;
      &lt;transition event="done.state.Test2" next="Test3"/&gt;
    &lt;/state&gt;

    &lt;state id="Test3"&gt;
      &lt;initial&gt;
        &lt;transition target="Test3Sub1"/&gt;
      &lt;/initial&gt;

      &lt;state id="Test3Sub1"&gt;
        &lt;onentry&gt;
          &lt;log expr="'Inside Test3Sub1...'"/&gt;
          &lt;!-- Send our self an event in 5s --&gt;
          &lt;send event="'Timer'"  delay="'5s'"/&gt;
        &lt;/onentry&gt;
        &lt;!-- Transition on to Test4.
             This will exit both us and our parent. --&gt;
        &lt;transition event="Timer" target="Test4"/&gt;
        &lt;onexit&gt;
          &lt;log expr="'Leaving Test3Sub1...'"/&gt;
        &lt;/onexit&gt;
      &lt;/state&gt;

      &lt;onexit&gt;
        &lt;log expr="'Leaving Test3...'"/&gt;
      &lt;/onexit&gt;
    &lt;/state&gt;
    
    &lt;state id="Test4"&gt;
      &lt;onentry&gt;
        &lt;log expr="'Inside Test4...'"/&gt;
      &lt;/onentry&gt;
      &lt;initial&gt;
        &lt;transition target="Test4Sub1"/&gt;
      &lt;/initial&gt;

      &lt;state id="Test4Sub1"&gt;
        &lt;onexit&gt;
          &lt;log expr="'Leaving Test4Sub1...'"/&gt;
        &lt;/onexit&gt;
        &lt;!-- This transition causes the state to exit immediately
             after entering Test4Sub1.  The transition has no event
             or guard so it is always active --&gt;
        &lt;transition target="Test5"/&gt;
      &lt;/state&gt;
    &lt;/state&gt;
       
    &lt;state id="Test5"&gt;
      &lt;onentry&gt;
        &lt;log expr="'Inside Test5...'"/&gt;
      &lt;/onentry&gt;
      &lt;initial&gt;
        &lt;transition target="Test5P"/&gt;
      &lt;/initial&gt;

      &lt;!-- Fire off parallel states.  In a more realistic example
      the parallel substates Test5PSub1 and Test5PSub2 would themselves
      have substates and would do some real work before transitioning to final substates --&gt;
      &lt;parallel id="Test5P"&gt;
        &lt;state id="Test5PSub1" initial="Test5PSub1Final"&gt;
           &lt;final id="Test5PSub1Final"/&gt;
           &lt;/state&gt;
        &lt;state id="Test5PSub2" initial="Test5PSub2Final"&gt;
            &lt;final id="Test5PSub2Final"/&gt;
            &lt;/state&gt;
        &lt;onexit&gt;
          &lt;log expr="'all parallel states done'"/&gt;
        &lt;/onexit&gt;
      &lt;/parallel&gt;

      &lt;!-- The parallel states immediately transition to final substates,
      so this event is generated immediately.   --&gt;
      &lt;transition event="done.state.Test5P" target="Test6"/&gt;
    &lt;/state&gt;

    &lt;!-- 
         - This state shows invocation of an external component.
         - We will use CCXML + VoiceXML actions as an example 
         - as it is a good smoke test to show how it all 
         - fits together. 
         - Note: In a real app you would likely 
         - split this over several states but we 
         - are trying to keep it simple here. 
    --&gt;
    &lt;state id="Test6"
           xmlns:ccxml="http://www.w3.org/2002/09/ccxml"
           xmlns:v3="http://www.w3.org/2005/07/vxml3"&gt;
      &lt;datamodel&gt;
        &lt;data name="ccxmlid" expr="32459"/&gt;
        &lt;date name="v3id" expr="17620"/&gt;
        &lt;data name="dest" expr="'tel:+18315552020'"/&gt;
        &lt;data name="src" expr="'helloworld2.vxml'"/&gt;
        &lt;data name="id" expr="'HelloWorld'"/&gt;
      &lt;/datamodel&gt;

      &lt;onentry&gt;
        &lt;!-- Use &lt;send&gt; a message to a CCXML Processor asking it to run createcall --&gt;
        &lt;send target="ccxmlid" type="basichttp" event="ccxml:createcall" namelist="dest"/&gt;
      &lt;/onentry&gt;

      &lt;transition event="ccxml:connection.connected"&gt;      
        &lt;!-- Here as a platform-specific extension we use example V3 
             Custom Action Elements instead of send. The implementation of this logic 
             would be platform-dependent. --&gt;
        &lt;v3:form id="HelloWorld"&gt;
          &lt;v3:block&gt;&lt;v3:prompt&gt;Hello World!&lt;/v3:prompt&gt;&lt;/v3:block&gt;          
        &lt;/v3:form&gt;
      &lt;/transition&gt;

      &lt;transition event="v3:HelloWorld.done"&gt;
        &lt;!-- Here we are using the low level &lt;send&gt; 
             element to run a v3 form. Note that the event "v3:HelloWorld.done" 
             is assumed either to be set/sent explicitly by the v3:form code or 
             implicitly by some process outside of the v3:form --&gt;
        &lt;send target="v3id" type="basichttp" event="v3:formstart" namelist="src id"/&gt;
      &lt;/transition&gt;

      &lt;transition event="v3:HelloWorld2.done"&gt;
        &lt;!-- we use _event.data to access data in the event we're processing.
             Again we assume the v3:HelloWorld2.done is set/sent from outside
             this document --&gt;
        &lt;ccxml:disconnect connectionid="_event.data.connectionid"/&gt;      
      &lt;/transition&gt;

      &lt;transition event="ccxml:connection.disconnected" target="Done"/&gt;
  
      &lt;transition event="send.failed" target="Done"&gt;
        &lt;!-- If we get an error event we move to the Done state that 
             is a final state. --&gt;
        &lt;log expr="'Sending to and External component failed'"/&gt;
      &lt;/transition&gt;

      &lt;onexit&gt;
        &lt;log expr="'Finished with external component'"/&gt;
      &lt;/onexit&gt;
    &lt;/state&gt;

    &lt;!-- This final state is an immediate child of Main
         -  when we get here, Main.done is generated. --&gt;
    &lt;final id="Done"/&gt;
    &lt;!-- End of Main &gt; --&gt;
  &lt;/state&gt;
&lt;/scxml&gt;
</pre>
</div>
</div>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11827" name="N11827" />Example:
Test2Sub1.xml</div>

<div class="exampleInner">
<pre>
  &lt;!-- This is an example substate defined in
  - an external file and included by Main.scxml.
  --&gt;
  &lt;state id="Test2Sub1"&gt;
    &lt;onentry&gt;
      &lt;log expr="'Inside Test2Sub1'"/&gt;
    &lt;/onentry&gt;
    &lt;transition event="Event2" target="Test2Sub2"/&gt;
  &lt;/state&gt;
</pre>
</div>
</div>
</div>

<div class="div2">
<h3><a id="N1182D" name="N1182D" />G.2 Microwave Example</h3>

<p>The example below shows the implementation of a simple microwave
oven using SCXML.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11832" name="N11832" />Example:
microwave-01.scxml</div>

<div class="exampleInner">
<pre>
&lt;?xml version="1.0"?&gt;
&lt;scxml xmlns="http://www.w3.org/2005/07/scxml"
       version="1.0"
       datamodel="ecmascript"
       initial="off"&gt;

  &lt;!--  trivial 5 second microwave oven example --&gt;
  &lt;datamodel&gt;
    &lt;data id="cook_time" expr="5"/&gt;
    &lt;data id="door_closed" expr="true"/&gt;
    &lt;data id="timer" expr="0"/&gt;
  &lt;/datamodel&gt;

  &lt;state id="off"&gt;
    &lt;!-- off state --&gt;
    &lt;transition event="turn.on" target="on"/&gt;
  &lt;/state&gt;

  &lt;state id="on"&gt;
    &lt;initial&gt;
        &lt;transition target="idle"/&gt;
    &lt;/initial&gt;
    &lt;!-- on/pause state --&gt;

    &lt;transition event="turn.off" target="off"/&gt;
    &lt;transition cond="timer &amp;gt;= cook_time" target="off"/&gt;

    &lt;state id="idle"&gt;
      &lt;!-- default immediate transition if door is shut --&gt;
      &lt;transition cond="door_closed" target="cooking"/&gt;
      &lt;transition event="door.close" target="cooking"&gt;
        &lt;assign location="door_closed" expr="true"/&gt;
        &lt;!-- start cooking --&gt;
      &lt;/transition&gt;
    &lt;/state&gt;

    &lt;state id="cooking"&gt;
      &lt;transition event="door.open" target="idle"&gt;
        &lt;assign location="door_closed" expr="false"/&gt;
      &lt;/transition&gt;

      &lt;!-- a 'time' event is seen once a second --&gt;
      &lt;transition event="time"&gt;
        &lt;assign location="timer" expr="timer + 1"/&gt;
      &lt;/transition&gt;
    &lt;/state&gt;

  &lt;/state&gt;

&lt;/scxml&gt;
</pre>
</div>
</div>
</div>

<div class="div2">
<h3><a id="MicrowaveParallel" name="MicrowaveParallel" />G.3
Microwave Example (Using parallel)</h3>

<p>The example below shows the implementation of a simple microwave
oven using &lt;parallel&gt; and the SCXML In() predicate.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N1183E" name="N1183E" />Example:
microwave-02.scxml</div>

<div class="exampleInner">
<pre>
&lt;?xml version="1.0"?&gt;
&lt;scxml xmlns="http://www.w3.org/2005/07/scxml"
       version="1.0"
       datamodel="ecmascript"
       initial="oven"&gt; 

  &lt;!-- trivial 5 second microwave oven example --&gt;
  &lt;!-- using parallel and In() predicate --&gt;
  &lt;datamodel&gt;
    &lt;data id="cook_time" expr="5"/&gt;
    &lt;data id="door_closed" expr="true"/&gt;
    &lt;data id="timer" expr="0"/&gt;
  &lt;/datamodel&gt;

  &lt;parallel id="oven"&gt;

    &lt;!-- this region tracks the microwave state and timer --&gt;
    &lt;state id="engine"&gt;
      &lt;transition target="off"/&gt;

      &lt;state id="off"&gt;
        &lt;!-- off state --&gt;
        &lt;transition event="turn.on" target="on"/&gt;
      &lt;/state&gt;
      
      &lt;state id="on"&gt;
        &lt;transition target="idle"/&gt;
         &lt;!-- on/pause state --&gt;
        
        &lt;transition event="turn.off" target="off"/&gt;
        &lt;transition cond="timer &amp;gt;= cook_time" target="off"/&gt;
        
        &lt;state id="idle"&gt;
          &lt;transition cond="In('closed')" target="cooking"/&gt;
        &lt;/state&gt;
        
        &lt;state id="cooking"&gt;
          &lt;transition cond="In('open')" target="idle"/&gt;

          &lt;!-- a 'time' event is seen once a second --&gt;
          &lt;transition event="time"&gt;
            &lt;assign location="timer" expr="timer + 1"/&gt;
          &lt;/transition&gt;
        &lt;/state&gt;
      &lt;/state&gt;
    &lt;/state&gt;

    &lt;!-- this region tracks the microwave door state --&gt;
    &lt;state id="door"&gt;
      &lt;initial&gt;
        &lt;transition target="closed"/&gt;
      &lt;/initial&gt;
      &lt;state id="closed"&gt;
        &lt;transition event="door.open" target="open"/&gt;
      &lt;/state&gt;
      &lt;state id="open"&gt;
        &lt;transition event="door.close" target="closed"/&gt;
       &lt;/state&gt;
    &lt;/state&gt;

  &lt;/parallel&gt;

&lt;/scxml&gt;
</pre>
</div>
</div>
</div>

<div class="div2">
<h3><a id="N11844" name="N11844" />G.4 Calculator Example</h3>

<p>The example below shows the implementation of a simple
calculator in SCXML.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11849" name="N11849" />Example:
calc.scxml</div>

<div class="exampleInner">
<pre>
&lt;?xml version="1.0" ?&gt;
&lt;scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"
       initial="on" datamodel="ecmascript" name="calc"&gt;
    &lt;datamodel&gt;
         &lt;data id="long_expr" /&gt;
         &lt;data id="short_expr" expr="0" /&gt;
         &lt;data id="res" /&gt;
    &lt;/datamodel&gt;
    &lt;state id="on" initial="ready"&gt;
        &lt;onentry&gt;
            &lt;send event="DISPLAY.UPDATE" /&gt;
        &lt;/onentry&gt;
        &lt;state id="ready" initial="begin"&gt;
        &lt;state id="begin"&gt;
            &lt;transition event="OPER.MINUS" target="negated1" /&gt;
            &lt;onentry&gt;
                &lt;send event="DISPLAY.UPDATE" /&gt;
            &lt;/onentry&gt;
        &lt;/state&gt;
        &lt;state id="result"&gt;
        &lt;/state&gt;
            &lt;transition event="OPER" target="opEntered" /&gt;
            &lt;transition event="DIGIT.0" target="zero1"&gt;
                &lt;assign location="short_expr" expr="''" /&gt;
            &lt;/transition&gt;
            &lt;transition event="DIGIT" target="int1"&gt;
                &lt;assign location="short_expr" expr="''" /&gt;
            &lt;/transition&gt;
            &lt;transition event="POINT" target="frac1"&gt;
                &lt;assign location="short_expr" expr="''" /&gt;
            &lt;/transition&gt;
        &lt;/state&gt;
        &lt;state id="negated1"&gt;
            &lt;onentry&gt;
                &lt;assign location="short_expr" expr="'-'" /&gt;
                &lt;send event="DISPLAY.UPDATE" /&gt;
            &lt;/onentry&gt;
            &lt;transition event="DIGIT.0" target="zero1" /&gt;
            &lt;transition event="DIGIT" target="int1" /&gt;
            &lt;transition event="POINT" target="frac1" /&gt;
        &lt;/state&gt;
        &lt;state id="operand1"&gt;
            &lt;state id="zero1"&gt;
                &lt;transition event="DIGIT" cond="_event.name != 'DIGIT.0'" target="int1" /&gt;
                &lt;transition event="POINT" target="frac1" /&gt;
            &lt;/state&gt;
            &lt;state id="int1"&gt;
                &lt;transition event="POINT" target="frac1" /&gt;
                &lt;transition event="DIGIT"&gt;
                    &lt;assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/transition&gt;
                &lt;onentry&gt;
                    &lt;assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/onentry&gt;
            &lt;/state&gt;
            &lt;state id="frac1"&gt;
                &lt;onentry&gt;
                    &lt;assign location="short_expr" expr="short_expr+'.'" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/onentry&gt;
                &lt;transition event="DIGIT"&gt;
                    &lt;assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/transition&gt;
            &lt;/state&gt;
            &lt;transition event="OPER" target="opEntered" /&gt;
        &lt;/state&gt;
        &lt;state id="opEntered"&gt;
            &lt;transition event="OPER.MINUS" target="negated2" /&gt;
            &lt;transition event="POINT" target="frac2" /&gt;
            &lt;transition event="DIGIT.0" target="zero2" /&gt;
            &lt;transition event="DIGIT" target="int2" /&gt;
            &lt;onentry&gt;
                &lt;raise event="CALC.SUB" /&gt;
                &lt;send target="_internal" event="OP.INSERT"&gt;
                    &lt;param name="operator" expr="_event.name" /&gt;
                &lt;/send&gt;
            &lt;/onentry&gt;
        &lt;/state&gt;
        &lt;state id="negated2"&gt;
            &lt;onentry&gt;
                &lt;assign location="short_expr" expr="'-'" /&gt;
                &lt;send event="DISPLAY.UPDATE" /&gt;
            &lt;/onentry&gt;
            &lt;transition event="DIGIT.0" target="zero2" /&gt;
            &lt;transition event="DIGIT" target="int2" /&gt;
            &lt;transition event="POINT" target="frac2" /&gt;
        &lt;/state&gt;
        &lt;state id="operand2"&gt;
            &lt;state id="zero2"&gt;
                &lt;transition event="DIGIT" cond="_event.name != 'DIGIT.0'" target="int2" /&gt;
                &lt;transition event="POINT" target="frac2" /&gt;
            &lt;/state&gt;
            &lt;state id="int2"&gt;
               &lt;transition event="DIGIT"&gt;
                    &lt;assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/transition&gt;
                &lt;onentry&gt;
                    &lt;assign location="short_expr" expr="short_expr+_event.name.substr(_event.name.lastIndexOf('.')+1)" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/onentry&gt;
                &lt;transition event="POINT" target="frac2" /&gt;
            &lt;/state&gt;
            &lt;state id="frac2"&gt;
                &lt;onentry&gt;
                    &lt;assign location="short_expr" expr="short_expr +'.'" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/onentry&gt;
                &lt;transition event="DIGIT"&gt;
                    &lt;assign location="short_expr" expr="short_expr +_event.name.substr(_event.name.lastIndexOf('.')+1)" /&gt;
                    &lt;send event="DISPLAY.UPDATE" /&gt;
                &lt;/transition&gt;
            &lt;/state&gt;
            &lt;transition event="OPER" target="opEntered"&gt;
                &lt;raise event="CALC.SUB" /&gt;
                &lt;raise event="OP.INSERT" /&gt;
            &lt;/transition&gt;
            &lt;transition event="EQUALS" target="result"&gt;
                &lt;raise event="CALC.SUB" /&gt;
                &lt;raise event="CALC.DO" /&gt;
            &lt;/transition&gt;
        &lt;/state&gt;
        &lt;transition event="C" target="on" /&gt;
    &lt;/state&gt;
    &lt;transition event="CALC.DO"&gt;
        &lt;assign location="short_expr" expr="''+ res" /&gt;
        &lt;assign location="long_expr" expr="''" /&gt;
        &lt;assign location="res" expr="0" /&gt;
    &lt;/transition&gt;
    &lt;transition event="CALC.SUB"&gt;
        &lt;if cond="short_expr!=''"&gt;
            &lt;assign location="long_expr" expr="long_expr+'('+short_expr+')'" /&gt;
        &lt;/if&gt;
        &lt;assign location="res" expr="eval(long_expr)" /&gt;
        &lt;assign location="short_expr" expr="''" /&gt;
        &lt;send event="DISPLAY.UPDATE" /&gt;
    &lt;/transition&gt;
    &lt;transition event="DISPLAY.UPDATE"&gt;
        &lt;log level="0" label="'result'" expr=".short_expr==''?res:short_expr" /&gt;
    &lt;/transition&gt;
    &lt;transition event="OP.INSERT"&gt;
        &lt;log level="0" expr="_event.data[0]" /&gt;
        &lt;if cond="_event.data[0] == 'OPER.PLUS'"&gt;
            &lt;assign location="long_expr" expr="long_expr+'+'" /&gt;
        &lt;elseif cond="_event.data[0]=='OPER.MINUS'" /&gt;
            &lt;assign location="long_expr" expr="long_expr+'-'" /&gt;
        &lt;elseif cond="_event.data[0]=='OPER.STAR'" /&gt;
            &lt;assign location="long_expr" expr="long_expr+'*'" /&gt;
        &lt;elseif cond="_event.data[0]=='OPER.DIV'" /&gt;
            &lt;assign location="long_expr" expr="long_expr+'/'" /&gt;
        &lt;/if&gt;
    &lt;/transition&gt;
&lt;/scxml&gt;
</pre>
</div>
</div>
</div>

<div class="div2">
<h3><a id="N1184F" name="N1184F" />G.5 Shale Example</h3>

<p>The example below, which is from the Apache Shale Project. Shale
is a web application framework based on JavaServer Faces (JSF).
It's composed of loosely coupled services that provide
functionality such as application event callbacks, dialogs with
conversation-scoped state, a view technology called Clay,
annotation-based functionality to reduce configuration requirements
and support for remoting. For more information on Shale please see
<a href="http://shale.apache.org/">http://shale.apache.org/</a>.
SCXML is used as a "dialog manager" service in Shale (for details
on the integration of SCXML in Shale please see <a
href="http://shale.apache.org/shale-dialog-scxml/index.html">http://shale.apache.org/shale-dialog-scxml/index.html</a>).
It allows Shale application authors to express navigation across
multiple JSF views and/or other conversations with users of a JSF
application using the SCXML markup notation. The example below
describes how the navigation across multiple JSF views can be
expressed using SCXML. It also shows how a submachine
(edit-profile-config.scxml) can be used within an SCXML file. The
binding language used in these examples is EL <a
href="#EL">[EL]</a>, which is the expression language supported in
the JSF environment.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11865" name="N11865" />Example:
log-on-config.scxml</div>

<img src="SCXMLExamples/logon.png" class="center"
alt="UML diagram for this example" /> 

<div class="exampleInner">
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!--
  Dialog definitions for Shale Use Cases Example Web Application
  written out as SCXML to demonstrate use of Commons SCXML as one
  of Shale's Dialog Manager implementations.
  For details, see: http://shale.apache.org/shale-dialog-scxml/
--&gt;
&lt;scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:my="http://scxml.example.com/"
       version="1.0" initial="checkCookie" datamodel="el" &gt;

  &lt;state id="checkCookie"&gt;
    &lt;onentry&gt;
      &lt;my:var name="cookieOutcome" expr="#{profile$logon.check}" /&gt;
    &lt;/onentry&gt;
    &lt;transition cond="${cookieOutcome eq 'authenticated'}" target="exit"/&gt;
    &lt;transition cond="${cookieOutcome eq 'unauthenticated'}" target="logon"/&gt;

  &lt;/state&gt;

  &lt;state id="logon"&gt;
    &lt;transition event="faces.outcome" cond="${outcome eq 'authenticated'}" target="exit"/&gt;
    &lt;transition event="faces.outcome" cond="${outcome eq 'create'}" target="createProfile"/&gt;
  &lt;/state&gt;


  &lt;state id="createProfile" src="edit-profile-config.xml" &gt;
      &lt;transition event="createProfile.done" cond="${outcome eq 'success' or outcome eq 'cancel'}" target="exit"/&gt;
  &lt;/state&gt;

  &lt;final id="exit"/&gt;

&lt;/scxml&gt;
</pre>
</div>
</div>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11872" name="N11872" />Example:
edit-profile-config.scxml</div>

<img src="SCXMLExamples/editprofile.png" class="center"
alt="UML diagram for this example" /> 

<div class="exampleInner">
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!--
  Dialog definitions for Shale Use Cases Example Web Application
  written out as SCXML to demonstrate use of Commons SCXML as one
  of Shale's Dialog Manager implementations.
  For details, see: http://shale.apache.org/shale-dialog-scxml/
--&gt;
&lt;scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:my="http://scxml.example.com/"
       version="1.0" initial="edit" datamodel="el"&gt;

  &lt;state id="edit"&gt;
    &lt;initial&gt;
      &lt;transition target="setup"/&gt;
    &lt;/initial&gt;

    &lt;!-- global transitions (within state "edit") --&gt;
    &lt;transition event="faces.outcome" cond="${outcome eq 'cancel'}" target="cancel"/&gt;
    &lt;transition event="faces.outcome" cond="${outcome eq 'finish'}" target="finish"/&gt;

    &lt;state id="setup"&gt;
      &lt;onentry&gt;
        &lt;my:var name="setupOutcome" expr="#{profile$edit.setup}" /&gt;
      &lt;/onentry&gt;
      &lt;transition cond="${setupOutcome eq 'success'}" target="page1"/&gt;
    &lt;/state&gt;

    &lt;state id="page1"&gt;
      &lt;transition event="faces.outcome" cond="${outcome eq 'next'}" target="page2"/&gt;
    &lt;/state&gt;

    &lt;state id="page2"&gt;

      &lt;transition event="faces.outcome" cond="${outcome eq 'previous'}" target="page1"/&gt;
      &lt;transition event="faces.outcome" cond="${outcome eq 'next'}" target="page3"/&gt;

    &lt;/state&gt;

    &lt;state id="page3"&gt;
      &lt;transition event="faces.outcome" cond="${outcome eq 'previous'}" target="page2"/&gt;
      &lt;transition event="faces.outcome" cond="${outcome eq 'next'}" target="editExit"/&gt;
    &lt;/state&gt;

  &lt;/state&gt;

  &lt;state id="cancel"&gt;

  &lt;onentry&gt;
      &lt;my:var name="cancelOutcome" expr="#{profile$edit.cancel}" /&gt;
    &lt;/onentry&gt;
    &lt;transition cond="${cancelOutcome eq 'success'}" target="editExit"&gt;
      &lt;my:var name="outcome" expr="cancel"/&gt;
    &lt;/transition&gt;
  &lt;/state&gt; 

  &lt;state id="finish"&gt;

    &lt;onentry&gt;
      &lt;my:var name="finishOutcome" expr="#{profile$edit.finish}" /&gt;
    &lt;/onentry&gt;

    &lt;transition cond="${finishOutcome eq 'username'}" target="page1"/&gt;
    &lt;transition cond="${finishOutcome eq 'password'}" target="page1"/&gt;
    &lt;transition cond="${finishOutcome eq 'success'}" target="editExit"&gt;
      &lt;my:var name="outcome" expr="success"/&gt;
    &lt;/transition&gt;
  &lt;/state&gt;

  &lt;final id="editExit"/&gt;

&lt;/scxml&gt;
</pre>
</div>
</div>
</div>

<div class="div2">
<h3><a id="invokeex" name="invokeex" />G.6 Examples of Invoke and
finalize</h3>

<p>The following two SCXML documents demonstrate the use of Invoke
and finalize. The first example shows the control flow for a voice
portal offering traffic reports.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N11885" name="N11885" />Example:
Traffic Report</div>

<div class="exampleInner">
<pre>
&lt;?xml version="1.0"?&gt;
&lt;?access-control allow="*"?&gt;
&lt;scxml version="1.0" initial="Intro" datamodel="ecmascript"&gt;
  &lt;state id="Intro"&gt;
    &lt;invoke src="dialog.vxml#Intro" type="vxml2"/&gt;
    &lt;transition event="success" cond="sessionChrome.playAds" target="PlayAds"/&gt;
    &lt;transition event="success" cond="!sessionChrome.playAds &amp;amp;&amp;amp; ANIQuality" 
                    target="ShouldGoBack"/&gt;
    &lt;transition event="success" cond="!sessionChrome.playAds &amp;amp;&amp;amp; !ANIQuality" 
                    target="StartOver"/&gt;
  &lt;/state&gt;

  &lt;state id="PlayAds"&gt;
    &lt;invoke src="dialog.vxml#PlayAds" type="vxml2"/&gt;
    &lt;transition event="success" cond="ANIQuality" target="ShouldGoBack"/&gt;
    &lt;transition event="success" cond="!ANIQuality" target="StartOver"/&gt;
  &lt;/state&gt;

  &lt;state id="StartOver"&gt;
    &lt;onenter&gt;
      &lt;script&gt;enterStartOver();&lt;/script&gt;
    &lt;/onenter&gt;
    &lt;invoke src="dialog.vxml#StartOver" type="vxml2"&gt;
      &lt;param name="gotItFromANI" expr="gotItFromANI"/&gt;
      &lt;finalize&gt;
        &lt;script&gt;finalizeStartOver();&lt;/script&gt;
      &lt;/finalize&gt;
    &lt;/invoke&gt;
    &lt;transition event="success" target="ShouldGoBack"/&gt;
    &lt;transition event="doOver" target="StartOver"/&gt;
    &lt;transition event="restart" target="Intro"/&gt; &lt;!-- bail out to caller --&gt;
  &lt;/state&gt;

  &lt;state id="ShouldGoBack"&gt;
    &lt;invoke src="dialog.vxml#ShouldGoBack" type="vxml2"&gt;
      &lt;param name="cityState" expr="cityState"/&gt;
      &lt;param name="gotItFromANI" expr="gotItFromANI"/&gt;
      &lt;finalize&gt;
        &lt;script&gt;finalizeShouldGoBack();&lt;/script&gt;
      &lt;/finalize&gt;
    &lt;/invoke&gt;
    &lt;transition event="highWay" target="HighwayReport"/&gt;
    &lt;transition event="go_back" target="StartOver"/&gt;
    &lt;transition event="doOver" target="ShouldGoBack"/&gt;
    &lt;transition event="restart" target="Intro"/&gt;
  &lt;/state&gt;

  &lt;state id="HighwayReport"&gt;
    &lt;invoke src="dialog.vxml#HighwayReport" type="vxml2"&gt;
      &lt;param name="cityState" expr="cityState"/&gt;
      &lt;param name="gotItFromANI" expr="gotItFromANI"/&gt;
      &lt;param name="playHRPrompt" expr="playHRPrompt"/&gt;
      &lt;param name="metroArea" expr="metroArea"/&gt;
      &lt;finalize&gt;
        &lt;script&gt;finalizeHighwayReport();&lt;/script&gt;
      &lt;/finalize&gt;
    &lt;/invoke&gt;
    &lt;transition event="highway" target="PlayHighway"/&gt;
    &lt;transition event="go_back" target="StartOver"/&gt;
    &lt;transition event="doOver" target="HighwayReport"/&gt;
    &lt;transition event="fullreport" target="FullReport"/&gt;
    &lt;transition event="restart" target="Intro"/&gt;
  &lt;/state&gt;

  &lt;state id="FullReport"&gt;
    &lt;invoke src="dialog.vxml#FullReport" type="vxml2"&gt;
      &lt;param name="cityState" expr="cityState"/&gt;
      &lt;param name="metroArea" expr="metroArea"/&gt;
      &lt;finalize&gt;
        &lt;script&gt;finalizeFullReport();&lt;/script&gt;
      &lt;/finalize&gt;
    &lt;/invoke&gt;
    &lt;transition event="go_back" target="HighwayReport"/&gt;
    &lt;transition event="new_city" target="StartOver"/&gt;
  &lt;/state&gt;

  &lt;state id="PlayHighway"&gt;
    &lt;invoke src="dialog.vxml#PlayHighway" type="vxml2"&gt;
      &lt;param name="cityState" expr="cityState"/&gt;
      &lt;param name="curHighway" expr="curHighway"/&gt;
      &lt;finalize&gt;
        &lt;script&gt;finalizePlayHighway();&lt;/script&gt;
      &lt;/finalize&gt;
    &lt;/invoke&gt;
    &lt;transition event="go_back" target="HighwayReport"/&gt;
  &lt;/state&gt;
&lt;/scxml&gt;

</pre>
</div>
</div>

<p>The following example shows a the control flow for a blackjack
game.</p>

<div class="exampleOuter">
<div class="exampleHeader"><a id="N1188D" name="N1188D" />Example:
Blackjack</div>

<div class="exampleInner">
<pre>
&lt;?xml version="1.0"?&gt;
&lt;?access-control allow="*"?&gt;
&lt;scxml version="1.0" datamodel="ecmascript" initial="master"&gt; &lt;state id="master"&gt;
    &lt;initial id="init1"&gt;
      &lt;transition target="_home"/&gt;
    &lt;/initial&gt;
    &lt;transition event="new_dealer" target="NewDealer"/&gt;
    &lt;transition event="mumble" target="_home"/&gt; &lt;!-- bail out to caller --&gt;
    &lt;transition event="silence" target="_home"/&gt; &lt;!-- bail out to caller --&gt;
    &lt;state id="_home"&gt;
      &lt;onenter&gt;
        &lt;script&gt;
        _data = {};
        &lt;/script&gt;
      &lt;/onenter&gt;
      &lt;invoke src="datamodel.v3#InitDataModel" type="vxml3"&gt;
        &lt;finalize&gt;
          &lt;script&gt;
          var n;
          for (n in event) {
              _data[n] = event[n];
          }
          &lt;/script&gt;
        &lt;/finalize&gt;
      &lt;/invoke&gt;
      &lt;transition event="success" target="Welcome"/&gt;
    &lt;/state&gt;

    &lt;state id="Welcome"&gt;
      &lt;invoke src="dialog.vxml#Welcome" type="vxml3"&gt;
        &lt;param name="skinpath" expr="skinpath"/&gt;
      &lt;/invoke&gt;
      &lt;transition event="success" target="Intro2"/&gt;
    &lt;/state&gt;

    &lt;state id="Intro2"&gt;
      &lt;invoke src="dialog.vxml#Intro2" type="vxml3"&gt;
        &lt;param name="skinpath" expr="skinpath"/&gt;
      &lt;/invoke&gt;
      &lt;transition event="success" target="EvalDeal"/&gt;
    &lt;/state&gt;

    &lt;state id="EvalDeal"&gt;
      &lt;onenter&gt;
        &lt;script&gt;enterEvalDeal();&lt;/script&gt;
      &lt;/onenter&gt;
      &lt;invoke src="dialog.vxml#EvalDeal" type="vxml3"&gt;
        &lt;param name="skinpath" expr="skinpath"/&gt;
        &lt;param name="playercard1" expr="playercard1"/&gt;
        &lt;param name="playercard2" expr="playercard2"/&gt;
        &lt;param name="playertotal" expr="blackjack.GetTotalOf('caller').toString()"/&gt;
        &lt;param name="dealercardshowing" expr="dealercardshowing"/&gt;
      &lt;/invoke&gt;
      &lt;transition event="success" target="AskHit"/&gt;
    &lt;/state&gt;

    &lt;state id="AskHit"&gt;
      &lt;invoke src="dialog.vxml#AskHit" type="vxml3"&gt;
        &lt;param name="skinpath" expr="skinpath"/&gt;
        &lt;finalize&gt;
          &lt;script&gt;finalizeAskHit();&lt;/script&gt;
        &lt;/finalize&gt;
      &lt;/invoke&gt;
      &lt;transition event="hit" target="PlayNewCard"/&gt;
      &lt;transition event="stand" target="PlayDone"/&gt;
    &lt;/state&gt;

    &lt;state id="PlayNewCard"&gt;
      &lt;invoke src="dialog.vxml#PlayNewCard" type="vxml3"&gt;
        &lt;param name="skinpath" expr="skinpath"/&gt;
        &lt;param name="playernewcard" expr="playernewcard"/&gt;
        &lt;param name="playertotal" expr="blackjack.GetTotalOf('caller').toString()"/&gt;
      &lt;/invoke&gt;
      &lt;transition event="success" cond="blackjack.GetTotalOf('caller') &amp;gt;= 21" target="PlayDone"/&gt;
      &lt;transition event="success" target="AskHit"/&gt; &lt;!-- less than 21 --&gt;
    &lt;/state&gt;

    &lt;state id="PlayDone"&gt;
      &lt;onenter&gt;
        &lt;script&gt;enterPlayDone();&lt;/script&gt;
      &lt;/onenter&gt;
      &lt;invoke src="dialog.vxml#PlayDone" type="vxml3"&gt;
        &lt;param name="skinpath" expr="skinpath"/&gt;
        &lt;param name="gameresult" expr="blackjack.GetGameResult()"/&gt;
        &lt;param name="dealertotal" expr="blackjack.GetTotalOf('dealer').toString()"/&gt;
      &lt;/invoke&gt;
      &lt;transition event="playagain" target="Intro2"/&gt;
      &lt;transition event="quit" target="_home"/&gt;
    &lt;/state&gt;

    &lt;state id="NewDealer"&gt;
      &lt;onenter&gt;
       &lt;script&gt;enterNewDealer();&lt;/script&gt;
      &lt;/onenter&gt;
      &lt;invoke src="dialog.vxml#Dummy" type="vxml3"/&gt;
      &lt;transition event="success" target="Welcome"/&gt;
    &lt;/state&gt;
  &lt;/state&gt;
&lt;/scxml&gt;


</pre>
</div>
</div>
</div>

<div class="div2">
<h3><a id="content_and_namespaces"
name="content_and_namespaces" />G.7 Inline Content and
Namespaces</h3>

<p>Since SCXML documents are XML documents, normal XML namespace
rules apply to inline content specified with &lt;content&gt; and
&lt;data&gt;. In particular, if no namespace is specified, the
inline content will be placed in the SCXML namespace. Consider the
following example:</p>

<div class="exampleOuter">
<pre>
     
 &lt;send target="http://example.com/send/target" type="'basichttp'"&gt;
   &lt;content&gt;
     &lt;a&gt;fffff&lt;/a&gt;
   &lt;/content&gt;
  &lt;/send&gt;
 
</pre>
</div>

<p>The recipient of the message will see the following:</p>

<div class="exampleOuter">
<pre>
     
 &lt;a xmlns="http://www.w3.org/2005/07/scxml"&gt;fffff&lt;/a&gt;
 
</pre>
</div>

<p>The following markup would cause the message to be delivered
without namespaces:</p>

<div class="exampleOuter">
<pre>
     
 &lt;send target="http://example.com/send/target" type="'basichttp'"&gt;
   &lt;content&gt;
     &lt;a xmlns=""&gt;fffff&lt;/a&gt;
   &lt;/content&gt;
  &lt;/send&gt;
 
</pre>
</div>

<p>The recipient of the message will see the following:</p>

<div class="exampleOuter">
<pre>
     
 &lt;a&gt;fffff&lt;/a&gt;
 
</pre>
</div>

<p>The sender can also specify multiple namespaces:</p>

<div class="exampleOuter">
<pre>
     
&lt;send target="http://example.com/send/target" type="'basichttp'"&gt;
 &lt;content&gt;
   &lt;root xmlns="http://example.com/r" xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c"&gt;
      &lt;a:alpha&gt;1&lt;/a:alpha&gt;
      &lt;b:beta&gt;2&lt;/b:beta&gt;
      &lt;c:gamma&gt;3&lt;/c:gamma&gt;
   &lt;/root&gt;
 &lt;/content&gt;
&lt;/send&gt;
 
</pre>
</div>

<p>In this case, the receiver would see:</p>

<div class="exampleOuter">
<pre>
  
  &lt;root xmlns="http://example.com/r"&gt;
      &lt;alpha xmlns="http://example.com/a"&gt;1&lt;/alpha&gt;
      &lt;beta xmlns="http://example.com/b&gt;2&lt;/beta&gt;
      &lt;gamma xmlns="http://example.com/c&gt;3&lt;/gamma&gt;
  &lt;/root&gt;
 
</pre>
</div>
</div>

<div class="div2">
<h3><a id="custom_action" name="custom_action" />G.8 Custom Action
Elements</h3>

<p>Custom Action Elements can be defined in other
specifications/namespaces and are responsible for performing
actions on behalf of custom components. Logically Custom Action
Elements can be thought of as a collection of actions and handlers
to perform specific tasks. An example of this is a CCXML
&lt;accept&gt; element that is a Custom Action Element:</p>

<div class="exampleInner">
<pre>
&lt;transition event="ccxml:connection.alerting"&gt;
  &lt;ccxml:accept connectionid="_event.data.connectionid"/&gt;
&lt;/transition&gt;
</pre>
</div>

<p>This could be written using a &lt;send&gt; element using the
following syntax:</p>

<div class="exampleInner">
<pre>
&lt;datamodel&gt;
&lt;data name="connectionid"/&gt;
&lt;/datamodel&gt;
&lt;transition event="ccxml:connection.alerting"&gt;
  &lt;assign name="connectionid" expr="_event.data.connectionid"/&gt;
 &lt;send type="ccxml" event="ccxml:accept" namelist="connectionid"/&gt; 
&lt;/transition&gt;
</pre>
</div>

<p>A more complicated example might be a CCXML &lt;createcall&gt;
where you are both providing variables and getting values back that
using only the &lt;send&gt; syntax would be more complex as it
would need to be broken over several steps. For example:</p>

<div class="exampleInner">
<pre>
&lt;onentry&gt;
  &lt;ccxml:createcall dest="'tel:+18315552020'" connectionid="myConnectionID"/&gt; 
&lt;/onentry&gt;
</pre>
</div>

<p>Would need to be modeled in two steps using &lt;send&gt; as you
would need to do something like the following:</p>

<div class="exampleInner">
<pre>
&lt;datamodel&gt;
  &lt;data name="dest" expr="'tel:+18315552020'"/&gt;
  &lt;data name="connectionid"/&gt;
&lt;/datamodel&gt;
&lt;onentry&gt;
  &lt;send type="ccxml" event="ccxml:createcall" namelist="dest"/&gt;
&lt;/onentry&gt;
&lt;transition event="ccxml:createcall.success"&gt;
   &lt;assign name="connectionid" expr="_event.data.connectionid"/&gt;
&lt;/transition&gt;
</pre>
</div>

<p>The exact mappings between Custom Action Elements and
&lt;send&gt; actions are to be defined in the individual Custom
Action Element specifications.</p>
</div>
</div>

<div class="div1">
<h2><a id="references" name="references" />H References</h2>

<dl>
<dt class="label"><a id="CSS2" name="CSS2" />CSS2</dt>

<dd><a
href="http://www.w3.org/TR/1998/REC-CSS2-19980512/"><cite>Cascading
Style Sheets, level 2: CSS2 Specification</cite></a>. B. Bos, et
al., Editors. World Wide Web Consortium, 12 May 1998. This version
of the CSS2 Recommendation is
http://www.w3.org/TR/1998/REC-CSS2-19980512/. The latest version of
CSS2 is available at http://www.w3.org/TR/REC-CSS2/. (See
http://www.w3.org/TR/1998/REC-CSS2-19980512/.)</dd>

<dt class="label"><a id="ebXML" name="ebXML" />OASIS ebXML</dt>

<dd><a
href="http://www.oasis-open.org/committees/documents.php?wg_abbrev=ebxml-bp">
<cite>ebXML Business Process Specification Schema v2.0</cite></a>.
(See
http://www.oasis-open.org/committees/documents.php?wg_abbrev=ebxml-bp.)</dd>

<dt class="label"><a id="DOMEvents"
name="DOMEvents" />DOMEvents</dt>

<dd><a
href="http://www.w3.org/TR/DOM-Level-3-Events/"><cite>EDocument
Object Model (DOM) Level 3 Events Specification</cite></a> W3C
Working Draft, September 2009. (See
http://www.w3.org/TR/DOM-Level-3-Events/.)</dd>

<dt class="label"><a id="ECMAScript262"
name="ECMAScript262" />ECMASCRIPT-262</dt>

<dd><a
href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">
<cite>ECMAScript Language Specification</cite></a> Standard
ECMA-262, 3rd Edition, December 1999. (See
http://www.ecma-international.org/publications/standards/Ecma-262.htm.)</dd>

<dt class="label"><a id="ECMAScript327"
name="ECMAScript327" />ECMASCRIPT-327</dt>

<dd><a
href="http://www.ecma-international.org/publications/standards/Ecma-327.htm">
<cite>ECMAScript 3rd Edition Compact Profile</cite></a> Standard
ECMA-327, July 2001. (See
http://www.ecma-international.org/publications/standards/Ecma-327.htm.)</dd>

<dt class="label"><a id="E4X" name="E4X" />E4X</dt>

<dd><a
href="http://www.ecma-international.org/publications/standards/Ecma-357.htm">
<cite>ECMAScript for XML (E4X) Specification</cite></a> Standard
ECMA-357, 2nd Edition, December 2005. (See
http://www.ecma-international.org/publications/standards/Ecma-357.htm.)</dd>

<dt class="label"><a id="EL" name="EL" />EL</dt>

<dd><a href="http://commons.apache.org/el/"><cite>EL: The JSP 2.0
Expression Language Interpreter</cite></a> (See
http://commons.apache.org/el/.)</dd>

<dt class="label"><a id="Harel_Politi" name="Harel_Politi" />Harel
and Politi</dt>

<dd><a
href="http://www.wisdom.weizmann.ac.il/~dharel/reactive_systems.html">
<cite>Modeling Reactive Systems with Statecharts: The STATEMATE
Approach</cite></a> By D. Harel and M. Politi. McGraw-Hill, 1998.
(See
http://www.wisdom.weizmann.ac.il/~dharel/reactive_systems.html.)</dd>

<dt class="label"><a id="RFC2119" name="RFC2119" />IETF RFC
2119</dt>

<dd><a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>RFC 2119:
Key words for use in RFCs to Indicate Requirement
Levels</cite></a>. Internet Engineering Task Force, 1997. (See
http://www.ietf.org/rfc/rfc2119.txt.)</dd>

<dt class="label"><a id="RFC2396" name="RFC2396" />IETF RFC
2396</dt>

<dd><a href="http://www.ietf.org/rfc/rfc2396.txt"><cite>RFC 2396:
Uniform Resource Identifiers</cite></a>. Internet Engineering Task
Force, 1995. (See http://www.ietf.org/rfc/rfc2396.txt.)</dd>

<dt class="label"><a id="CCXML" name="CCXML" />W3C CCXML 1.0</dt>

<dd><a
href="http://www.w3.org/TR/2005/WD-ccxml-20050111/"><cite>Voice
Browser Call Control: CCXML Version 1.0</cite></a>. W3C, 2005. (See
http://www.w3.org/TR/2005/WD-ccxml-20050111/.)</dd>

<dt class="label"><a id="HTTP" name="HTTP" />HTTP</dt>

<dd><a href="http://www.ietf.org/rfc/rfc2616.txt"><cite>CMultimodal
Architecture and Interfaces Working Draft</cite></a>. W3C, 2005.
(See http://www.ietf.org/rfc/rfc2616.txt.)</dd>

<dt class="label"><a id="JSON" name="JSON" />JSON</dt>

<dd><a href="http://www.ietf.org/rfc/rfc4627.txt"><cite>The
application/json Media Type for JavaScript Object Notation
(JSON)</cite></a> RFC 4627, July 2006. (See
http://www.ietf.org/rfc/rfc4627.txt.)</dd>

<dt class="label"><a id="MMI" name="MMI" />W3C MMI</dt>

<dd><a href="http://www.w3.org/TR/mmi-arch/"><cite>"Hypertext
Transfer Protocol -- HTTP/1.1 "</cite></a>. IETF RFC 2616, 199.
(See http://www.w3.org/TR/mmi-arch/.)</dd>

<dt class="label"><a id="RFC2616" name="RFC2616" />RFC2616</dt>

<dd><a href="http://www.ietf.org/rfc/rfc2616.txt"><cite>Hypertext
Transfer Protocol -- HTTP/1.1</cite></a> IETF RFC 2616, 1999. (See
http://www.ietf.org/rfc/rfc2616.txt.)</dd>

<dt class="label"><a id="RFC2617" name="RFC2617" />RFC2617</dt>

<dd><a href="http://www.ietf.org/rfc/rfc2617.txt"><cite>HTTP
Authentication: Basic and Digest Access Authentication</cite></a>
IETF RFC 2617, June 1999. (See
http://www.ietf.org/rfc/rfc2617.txt.)</dd>

<dt class="label"><a id="VoiceXML" name="VoiceXML" />W3C VoiceXML
2.0</dt>

<dd><a href="http://www.w3.org/TR/voicexml20/"><cite>VoiceXML
2.0:</cite></a> . W3C, 2004. (See
http://www.w3.org/TR/voicexml20/.)</dd>

<dt class="label"><a id="UML" name="UML" />UML 2.3</dt>

<dd><a href="http://www.omg.org/spec/UML/2.3/"><cite>UML
Specification Version 2.3</cite></a>. OMG, 2009. (See
http://www.omg.org/spec/UML/2.3/.)</dd>

<dt class="label"><a id="XMI" name="XMI" />UML XMI</dt>

<dd><a
href="http://www.omg.org/technology/documents/modeling_spec_catalog.htm#XMI">
<cite>XML Metadata Exchange version 2.1</cite></a>. (See
http://www.omg.org/technology/documents/modeling_spec_catalog.htm#XMI.)</dd>

<dt class="label"><a id="xinclude" name="xinclude" />XInclude</dt>

<dd><a href="http://www.w3.org/TR/xinclude/"><cite>XML Inclusions
(XInclude) Version 1.0</cite></a>. W3C, 2006. (See
http://www.w3.org/TR/xinclude/.)</dd>

<dt class="label"><a id="XML" name="XML" />XML</dt>

<dd><a href="http://www.w3.org/TR/xml/"><cite>Extensible Markup
Language (XML) 1.0 (Fourth Edition)</cite></a> T. Bray et. al. eds.
World Wide Web Consortium 16 August 2006 (See
http://www.w3.org/TR/xml/.)</dd>

<dt class="label"><a id="ID" name="ID" />XML ID</dt>

<dd><a
href="http://www.w3.org/TR/2005/REC-xml-id-20050909/"><cite>xml:id
version 1.0</cite></a> J. Marsh, D. Veillard, N. Walsh. World Wide
Web Consortium, 9 September 2005. (See
http://www.w3.org/TR/2005/REC-xml-id-20050909/.)</dd>

<dt class="label"><a id="XMLNames" name="XMLNames" />XMLNames</dt>

<dd><a
href="http://www.w3.org/TR/2006/REC-xml-names-20060816/"><cite>Namespaces
in XML 1.0 (Second Edition)</cite></a> T. Bray, D. Hollander, A.
Layman, R. Tobin, Editors, W3C Recommendation, 16 August 2006 (See
http://www.w3.org/TR/2006/REC-xml-names-20060816/.)</dd>

<dt class="label"><a id="Schema" name="Schema" />XML Schema</dt>

<dd><a href="http://www.w3.org/TR/xmlschema-2/"><cite>XML Schema
Part 2: Datatypes Second Edition</cite></a> P. Biron and A.
Malhotra. World Wide Web Consortium, 28 October 2004. (See
http://www.w3.org/TR/xmlschema-2/.)</dd>

<dt class="label"><a id="XPATH2" name="XPATH2" />XPath 2.0</dt>

<dd><a href="http://www.w3.org/TR/xpath20/"><cite>XML Path Language
(XPath) 2.0</cite></a> A. Berglund, S. Boag, D. Chamberlin, M.
Fernández, M. Kay, J. Robie, J. Siméon, January 2007 (See
http://www.w3.org/TR/xpath20/.)</dd>

<dt class="label"><a id="XPATH2FO" name="XPATH2FO" />XPath 2.0
Functions and Operators</dt>

<dd><a href="http://www.w3.org/TR/xpath-functions/"><cite>XQuery
1.0 and XPath 2.0 Functions and Operators</cite></a> A. Malhotra,
J. Melton, N. Walsh, January 2007 (See
http://www.w3.org/TR/xpath-functions/.)</dd>

<dt class="label"><a id="XTND" name="XTND" />XTND</dt>

<dd><a
href="http://www.w3.org/TR/2000/NOTE-xtnd-20001121/"><cite>XML
Transition Network Definition</cite></a>. (See
http://www.w3.org/TR/2000/NOTE-xtnd-20001121/.)</dd>
</dl>
</div>
</div>
</body>
</html>