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
|
<pre>Network Working Group S. Legg
Request for Comments: 4911 eB2Bcom
Category: Experimental July 2007
<span class="h1">Encoding Instructions for the</span>
<span class="h1">Robust XML Encoding Rules (RXER)</span>
Status of This Memo
This memo defines an Experimental Protocol for the Internet
community. It does not specify an Internet standard of any kind.
Discussion and suggestions for improvement are requested.
Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The IETF Trust (2007).
Abstract
This document defines encoding instructions that may be used in an
Abstract Syntax Notation One (ASN.1) specification to alter how ASN.1
values are encoded by the Robust XML Encoding Rules (RXER) and
Canonical Robust XML Encoding Rules (CRXER), for example, to encode a
component of an ASN.1 value as an Extensible Markup Language (XML)
attribute rather than as a child element. Some of these encoding
instructions also affect how an ASN.1 specification is translated
into an Abstract Syntax Notation X (ASN.X) specification. Encoding
instructions that allow an ASN.1 specification to reference
definitions in other XML schema languages are also defined.
<span class="grey">Legg Experimental [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Table of Contents
<a href="#section-1">1</a>. Introduction ....................................................<a href="#page-3">3</a>
<a href="#section-2">2</a>. Conventions .....................................................<a href="#page-3">3</a>
<a href="#section-3">3</a>. Definitions .....................................................<a href="#page-4">4</a>
<a href="#section-4">4</a>. Notation for RXER Encoding Instructions .........................<a href="#page-4">4</a>
<a href="#section-5">5</a>. Component Encoding Instructions .................................<a href="#page-6">6</a>
<a href="#section-6">6</a>. Reference Encoding Instructions .................................<a href="#page-8">8</a>
<a href="#section-7">7</a>. Expanded Names of Components ...................................<a href="#page-10">10</a>
<a href="#section-8">8</a>. The ATTRIBUTE Encoding Instruction .............................<a href="#page-11">11</a>
<a href="#section-9">9</a>. The ATTRIBUTE-REF Encoding Instruction .........................<a href="#page-12">12</a>
<a href="#section-10">10</a>. The COMPONENT-REF Encoding Instruction ........................<a href="#page-13">13</a>
<a href="#section-11">11</a>. The ELEMENT-REF Encoding Instruction ..........................<a href="#page-16">16</a>
<a href="#section-12">12</a>. The LIST Encoding Instruction .................................<a href="#page-17">17</a>
<a href="#section-13">13</a>. The NAME Encoding Instruction .................................<a href="#page-19">19</a>
<a href="#section-14">14</a>. The REF-AS-ELEMENT Encoding Instruction .......................<a href="#page-19">19</a>
<a href="#section-15">15</a>. The REF-AS-TYPE Encoding Instruction ..........................<a href="#page-20">20</a>
<a href="#section-16">16</a>. The SCHEMA-IDENTITY Encoding Instruction ......................<a href="#page-22">22</a>
<a href="#section-17">17</a>. The SIMPLE-CONTENT Encoding Instruction .......................<a href="#page-22">22</a>
<a href="#section-18">18</a>. The TARGET-NAMESPACE Encoding Instruction .....................<a href="#page-23">23</a>
<a href="#section-19">19</a>. The TYPE-AS-VERSION Encoding Instruction ......................<a href="#page-24">24</a>
<a href="#section-20">20</a>. The TYPE-REF Encoding Instruction .............................<a href="#page-25">25</a>
<a href="#section-21">21</a>. The UNION Encoding Instruction ................................<a href="#page-26">26</a>
<a href="#section-22">22</a>. The VALUES Encoding Instruction ...............................<a href="#page-27">27</a>
<a href="#section-23">23</a>. Insertion Encoding Instructions ...............................<a href="#page-29">29</a>
<a href="#section-24">24</a>. The VERSION-INDICATOR Encoding Instruction ....................<a href="#page-32">32</a>
<a href="#section-25">25</a>. The GROUP Encoding Instruction ................................<a href="#page-34">34</a>
<a href="#section-25.1">25.1</a>. Unambiguous Encodings ....................................<a href="#page-36">36</a>
<a href="#section-25.1.1">25.1.1</a>. Grammar Construction ..............................<a href="#page-37">37</a>
<a href="#section-25.1.2">25.1.2</a>. Unique Component Attribution ......................<a href="#page-47">47</a>
<a href="#section-25.1.3">25.1.3</a>. Deterministic Grammars ............................<a href="#page-52">52</a>
<a href="#section-25.1.4">25.1.4</a>. Attributes in Unknown Extensions ..................<a href="#page-54">54</a>
<a href="#section-26">26</a>. Security Considerations .......................................<a href="#page-56">56</a>
<a href="#section-27">27</a>. References ....................................................<a href="#page-56">56</a>
<a href="#section-27.1">27.1</a>. Normative References .....................................<a href="#page-56">56</a>
<a href="#section-27.2">27.2</a>. Informative References ...................................<a href="#page-57">57</a>
<a href="#appendix-A">Appendix A</a>. GROUP Encoding Instruction Examples ...................<a href="#page-58">58</a>
<a href="#appendix-B">Appendix B</a>. Insertion Encoding Instruction Examples ...............<a href="#page-74">74</a>
<a href="#appendix-C">Appendix C</a>. Extension and Versioning Examples .....................<a href="#page-87">87</a>
<span class="grey">Legg Experimental [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
This document defines encoding instructions [<a href="#ref-X.680-1">X.680-1</a>] that may be
used in an Abstract Syntax Notation One (ASN.1) [<a href="#ref-X.680">X.680</a>] specification
to alter how ASN.1 values are encoded by the Robust XML Encoding
Rules (RXER) [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] and Canonical Robust XML Encoding Rules (CRXER)
[<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>], for example, to encode a component of an ASN.1 value as an
Extensible Markup Language (XML) [<a href="#ref-XML10" title=""Extensible Markup Language (XML) 1.0 (Fourth Edition)"">XML10</a>] attribute rather than as a
child element. Some of these encoding instructions also affect how
an ASN.1 specification is translated into an Abstract Syntax Notation
X (ASN.X) specification [<a href="#ref-ASN.X" title=""Abstract Syntax Notation X (ASN.X)"">ASN.X</a>].
This document also defines encoding instructions that allow an ASN.1
specification to incorporate the definitions of types, elements, and
attributes in specifications written in other XML schema languages.
References to XML Schema [<a href="#ref-XSD1" title=""XML Schema Part 1: Structures Second Edition"">XSD1</a>] types, elements, and attributes,
RELAX NG [<a href="#ref-RNG" title=""RELAX NG Tutorial"">RNG</a>] named patterns and elements, and XML document type
definition (DTD) [<a href="#ref-XML10" title=""Extensible Markup Language (XML) 1.0 (Fourth Edition)"">XML10</a>] element types are supported.
In most cases, the effect of an encoding instruction is only briefly
mentioned in this document. The precise effects of these encoding
instructions are described fully in the specifications for RXER
[<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] and ASN.X [<a href="#ref-ASN.X" title=""Abstract Syntax Notation X (ASN.X)"">ASN.X</a>], at the points where they apply.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Conventions</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED" and "MAY" in this document are
to be interpreted as described in <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a> [<a href="#ref-BCP14" title=""Key words for use in RFCs to Indicate Requirement Levels"">BCP14</a>]. The key
word "OPTIONAL" is exclusively used with its ASN.1 meaning.
Throughout this document "type" shall be taken to mean an ASN.1 type,
and "value" shall be taken to mean an ASN.1 abstract value, unless
qualified otherwise.
A reference to an ASN.1 production [<a href="#ref-X.680">X.680</a>] (e.g., Type, NamedType) is
a reference to text in an ASN.1 specification corresponding to that
production. Throughout this document, "component" is synonymous with
NamedType.
This document uses the namespace prefix "xsi:" to stand for the
namespace name [<a href="#ref-XMLNS10" title=""Namespaces in XML 1.0 (Second Edition)"">XMLNS10</a>] "<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>".
Example ASN.1 definitions in this document are assumed to be defined
in an ASN.1 module with a TagDefault of "AUTOMATIC TAGS" and an
EncodingReferenceDefault [<a href="#ref-X.680-1">X.680-1</a>] of "RXER INSTRUCTIONS".
<span class="grey">Legg Experimental [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Definitions</span>
The following definition of base type is used in specifying a number
of encoding instructions.
Definition (base type): If a type, T, is a constrained type, then the
base type of T is the base type of the type that is constrained; else
if T is a prefixed type, then the base type of T is the base type of
the type that is prefixed; else if T is a type notation that
references or denotes another type (i.e., DefinedType,
ObjectClassFieldType, SelectionType, TypeFromObject, or
ValueSetFromObjects), then the base type of T is the base type of the
type that is referenced or denoted; otherwise, the base type of T is
T itself.
Aside: A tagged type is a special case of a prefixed type.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Notation for RXER Encoding Instructions</span>
The grammar of ASN.1 permits the application of encoding instructions
[<a href="#ref-X.680-1">X.680-1</a>], through type prefixes and encoding control sections, that
modify how abstract values are encoded by nominated encoding rules.
The generic notation for type prefixes and encoding control sections
is defined by the ASN.1 basic notation [<a href="#ref-X.680">X.680</a>] [<a href="#ref-X.680-1">X.680-1</a>], and
includes an encoding reference to identify the specific encoding
rules that are affected by the encoding instruction.
The encoding reference that identifies the Robust XML Encoding rules
is literally RXER. An RXER encoding instruction applies equally to
both RXER and CRXER encodings.
The specific notation for an encoding instruction for a specific set
of encoding rules is left to the specification of those encoding
rules. Consequently, this companion document to the RXER
specification [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] defines the notation for RXER encoding
instructions. Specifically, it elaborates the EncodingInstruction
and EncodingInstructionAssignmentList placeholder productions of the
ASN.1 basic notation.
In the context of the RXER encoding reference, the
EncodingInstruction production is defined as follows, using the
conventions of the ASN.1 basic notation:
<span class="grey">Legg Experimental [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
EncodingInstruction ::=
AttributeInstruction |
AttributeRefInstruction |
ComponentRefInstruction |
ElementRefInstruction |
GroupInstruction |
InsertionsInstruction |
ListInstruction |
NameInstruction |
RefAsElementInstruction |
RefAsTypeInstruction |
SimpleContentInstruction |
TypeAsVersionInstruction |
TypeRefInstruction |
UnionInstruction |
ValuesInstruction |
VersionIndicatorInstruction
In the context of the RXER encoding reference, the
EncodingInstructionAssignmentList production (which only appears in
an encoding control section) is defined as follows:
EncodingInstructionAssignmentList ::=
SchemaIdentityInstruction ?
TargetNamespaceInstruction ?
TopLevelComponents ?
TopLevelComponents ::= TopLevelComponent TopLevelComponents ?
TopLevelComponent ::= "COMPONENT" NamedType
Definition (top-level NamedType): A NamedType is a top-level
NamedType (equivalently, a top-level component) if and only if it is
the NamedType in a TopLevelComponent. A NamedType nested within the
Type of the NamedType of a TopLevelComponent is not itself a
top-level NamedType.
Aside: Specification writers should note that non-trivial types
defined within a top-level NamedType will not be visible to ASN.1
tools that do not understand RXER.
Although a top-level NamedType only appears in an RXER encoding
control section, the default encoding reference for the module
[<a href="#ref-X.680-1">X.680-1</a>] still applies when parsing a top-level NamedType.
Each top-level NamedType within a module SHALL have a distinct
identifier.
<span class="grey">Legg Experimental [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The NamedType production is defined by the ASN.1 basic notation. The
other productions are described in subsequent sections and make use
of the following productions:
NCNameValue ::= Value
AnyURIValue ::= Value
QNameValue ::= Value
NameValue ::= Value
The Value production is defined by the ASN.1 basic notation.
The governing type for the Value in an NCNameValue is the NCName type
from the AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>].
The governing type for the Value in an AnyURIValue is the AnyURI type
from the AdditionalBasicDefinitions module.
The governing type for the Value in a QNameValue is the QName type
from the AdditionalBasicDefinitions module.
The governing type for the Value in a NameValue is the Name type from
the AdditionalBasicDefinitions module.
The Value in an NCNameValue, AnyURIValue, QNameValue, or NameValue
SHALL NOT be a DummyReference [<a href="#ref-X.683">X.683</a>] and SHALL NOT textually contain
a nested DummyReference.
Aside: Thus, encoding instructions are not permitted to be
parameterized in any way. This restriction will become important
if a future specification for ASN.X explicitly represents
parameterized definitions and parameterized references instead of
expanding out parameterized references as in the current
specification. A parameterized definition could not be directly
translated into ASN.X if it contained encoding instructions that
were not fully specified.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Component Encoding Instructions</span>
Certain of the RXER encoding instructions are categorized as
component encoding instructions. The component encoding instructions
are the ATTRIBUTE, ATTRIBUTE-REF, COMPONENT-REF, GROUP, ELEMENT-REF,
NAME, REF-AS-ELEMENT, SIMPLE-CONTENT, TYPE-AS-VERSION, and
VERSION-INDICATOR encoding instructions (whose notations are
described respectively by AttributeInstruction,
AttributeRefInstruction, ComponentRefInstruction, GroupInstruction,
<span class="grey">Legg Experimental [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
ElementRefInstruction, NameInstruction, RefAsElementInstruction,
SimpleContentInstruction, TypeAsVersionInstruction, and
VersionIndicatorInstruction).
The Type in the EncodingPrefixedType for a component encoding
instruction SHALL be either:
(1) the Type in a NamedType, or
(2) the Type in an EncodingPrefixedType in a PrefixedType in a
BuiltinType in a Type that is one of (1) to (4), or
(3) the Type in an TaggedType in a PrefixedType in a BuiltinType in a
Type that is one of (1) to (4), or
(4) the Type in a ConstrainedType (excluding a TypeWithConstraint) in
a Type that is one of (1) to (4).
Aside: The effect of this condition is to force the component
encoding instructions to be textually within the NamedType to
which they apply. Only case (2) can be true on the first
iteration as the Type belongs to an EncodingPrefixedType; however,
any of (1) to (4) can be true on subsequent iterations.
Case (4) is not permitted when the encoding instruction is the
ATTRIBUTE-REF, COMPONENT-REF, ELEMENT-REF, or REF-AS-ELEMENT encoding
instruction.
The NamedType in case (1) is said to be "subject to" the component
encoding instruction.
A top-level NamedType SHALL NOT be subject to an ATTRIBUTE-REF,
COMPONENT-REF, GROUP, ELEMENT-REF, REF-AS-ELEMENT, or SIMPLE-CONTENT
encoding instruction.
Aside: This condition does not preclude these encoding
instructions being used on a nested NamedType.
A NamedType SHALL NOT be subject to two or more component encoding
instructions of the same kind, e.g., a NamedType is not permitted to
be subject to two NAME encoding instructions.
The ATTRIBUTE, ATTRIBUTE-REF, COMPONENT-REF, GROUP, ELEMENT-REF,
REF-AS-ELEMENT, SIMPLE-CONTENT, and TYPE-AS-VERSION encoding
instructions are mutually exclusive. The NAME, ATTRIBUTE-REF,
COMPONENT-REF, ELEMENT-REF, and REF-AS-ELEMENT encoding instructions
are mutually exclusive. A NamedType SHALL NOT be subject to two or
more encoding instructions that are mutually exclusive.
<span class="grey">Legg Experimental [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
A SelectionType [<a href="#ref-X.680">X.680</a>] SHALL NOT be used to select the Type from a
NamedType that is subject to an ATTRIBUTE-REF, COMPONENT-REF,
ELEMENT-REF or REF-AS-ELEMENT encoding instruction. The other
component encoding instructions are not inherited by the type denoted
by a SelectionType.
Definition (attribute component): An attribute component is a
NamedType that is subject to an ATTRIBUTE or ATTRIBUTE-REF encoding
instruction, or subject to a COMPONENT-REF encoding instruction that
references a top-level NamedType that is subject to an ATTRIBUTE
encoding instruction.
Definition (element component): An element component is a NamedType
that is not subject to an ATTRIBUTE, ATTRIBUTE-REF, GROUP, or
SIMPLE-CONTENT encoding instruction, and not subject to a
COMPONENT-REF encoding instruction that references a top-level
NamedType that is subject to an ATTRIBUTE encoding instruction.
Aside: A NamedType subject to a GROUP or SIMPLE-CONTENT encoding
instruction is neither an attribute component nor an element
component.
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Reference Encoding Instructions</span>
Certain of the RXER encoding instructions are categorized as
reference encoding instructions. The reference encoding instructions
are the ATTRIBUTE-REF, COMPONENT-REF, ELEMENT-REF, REF-AS-ELEMENT,
REF-AS-TYPE, and TYPE-REF encoding instructions (whose notations are
described respectively by AttributeRefInstruction,
ComponentRefInstruction, ElementRefInstruction,
RefAsElementInstruction, RefAsTypeInstruction, and
TypeRefInstruction). These encoding instructions (except
COMPONENT-REF) allow an ASN.1 specification to incorporate the
definitions of types, elements, and attributes in specifications
written in other XML schema languages, through implied constraints on
the markup that may appear in values of the Markup ASN.1 type from
the AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] (for ELEMENT-REF,
REF-AS-ELEMENT, REF-AS-TYPE, and TYPE-REF) or the UTF8String type
(for ATTRIBUTE-REF). References to XML Schema [<a href="#ref-XSD1" title=""XML Schema Part 1: Structures Second Edition"">XSD1</a>] types,
elements, and attributes, RELAX NG [<a href="#ref-RNG" title=""RELAX NG Tutorial"">RNG</a>] named patterns and elements,
and XML document type definition (DTD) [<a href="#ref-XML10" title=""Extensible Markup Language (XML) 1.0 (Fourth Edition)"">XML10</a>] element types are
supported. References to ASN.1 types and top-level components are
also permitted. The COMPONENT-REF encoding instruction provides a
more direct method of referencing a top-level component.
The Type in the EncodingPrefixedType for an ELEMENT-REF,
REF-AS-ELEMENT, REF-AS-TYPE, or TYPE-REF encoding instruction SHALL
be either:
<span class="grey">Legg Experimental [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(1) a ReferencedType that is a DefinedType that is a typereference
(not a DummyReference) or ExternalTypeReference that references
the Markup ASN.1 type from the AdditionalBasicDefinitions module
[<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>], or
(2) a BuiltinType that is a PrefixedType that is a TaggedType where
the Type in the TaggedType is one of (1) to (3), or
(3) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (1) to (3) and the EncodingPrefix in the
EncodingPrefixedType does not contain a reference encoding
instruction.
Aside: Case (3) and similar cases for the ATTRIBUTE-REF and
COMPONENT-REF encoding instructions have the effect of making the
reference encoding instructions mutually exclusive as well as
singly occurring.
With respect to the REF-AS-TYPE and TYPE-REF encoding instructions,
the DefinedType in case (1) is said to be "subject to" the encoding
instruction.
The restrictions on the Type in the EncodingPrefixedType for an
ATTRIBUTE-REF encoding instruction are specified in <a href="#section-9">Section 9</a>. The
restrictions on the Type in the EncodingPrefixedType for a
COMPONENT-REF encoding instruction are specified in <a href="#section-10">Section 10</a>.
The reference encoding instructions make use of a common production
defined as follows:
RefParameters ::= ContextParameter ?
ContextParameter ::= "CONTEXT" AnyURIValue
A RefParameters instance provides extra information about a reference
to a definition. A ContextParameter is used when a reference is
ambiguous, i.e., refers to definitions in more than one schema
document or external DTD subset. This situation would occur, for
example, when importing types with the same name from independently
developed XML Schemas defined without a target namespace [<a href="#ref-XSD1" title=""XML Schema Part 1: Structures Second Edition"">XSD1</a>].
When used in conjunction with a reference to an element type in an
external DTD subset, the AnyURIValue in the ContextParameter is the
system identifier (a Uniform Resource Identifier or URI [<a href="#ref-URI" title=""Uniform Resource Identifiers (URI): Generic Syntax"">URI</a>]) of the
external DTD subset; otherwise, the AnyURIValue is a URI that
indicates the intended schema document, either an XML Schema
specification, a RELAX NG specification, or an ASN.1 or ASN.X
specification.
<span class="grey">Legg Experimental [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Expanded Names of Components</span>
Each NamedType has an associated expanded name [<a href="#ref-XMLNS10" title=""Namespaces in XML 1.0 (Second Edition)"">XMLNS10</a>], determined
as follows:
(1) if the NamedType is subject to a NAME encoding instruction, then
the local name of the expanded name is the character string
specified by the NCNameValue of the NAME encoding instruction,
(2) else if the NamedType is subject to a COMPONENT-REF encoding
instruction, then the expanded name is the same as the expanded
name of the referenced top-level NamedType,
(3) else if the NamedType is subject to an ATTRIBUTE-REF or
ELEMENT-REF encoding instruction, then the namespace name of the
expanded name is equal to the namespace-name component of the
QNameValue of the encoding instruction, and the local name is
equal to the local-name component of the QNameValue,
(4) else if the NamedType is subject to a REF-AS-ELEMENT encoding
instruction, then the local name of the expanded name is the
LocalPart [<a href="#ref-XMLNS10" title=""Namespaces in XML 1.0 (Second Edition)"">XMLNS10</a>] of the qualified name specified by the
NameValue of the encoding instruction,
(5) otherwise, the local name of the expanded name is the identifier
of the NamedType.
In cases (1) and (5), if the NamedType is a top-level NamedType and
the module containing the NamedType has a TARGET-NAMESPACE encoding
instruction, then the namespace name of the expanded name is the
character string specified by the AnyURIValue of the TARGET-NAMESPACE
encoding instruction; otherwise, the namespace name has no value.
Aside: Thus, the TARGET-NAMESPACE encoding instruction applies to
a top-level NamedType but not to any other NamedType.
In case (4), if the encoding instruction contains a Namespace, then
the namespace name of the expanded name is the character string
specified by the AnyURIValue of the Namespace; otherwise, the
namespace name has no value.
The expanded names for the attribute components of a CHOICE,
SEQUENCE, or SET type MUST be distinct. The expanded names for the
components of a CHOICE, SEQUENCE, or SET type that are not attribute
components MUST be distinct. These tests are applied after the
COMPONENTS OF transformation specified in X.680, Clause 24.4 [<a href="#ref-X.680">X.680</a>].
<span class="grey">Legg Experimental [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Aside: Two components of the same CHOICE, SEQUENCE, or SET type
may have the same expanded name if one of them is an attribute
component and the other is not. Note that the "not" case includes
components that are subject to a GROUP or SIMPLE-CONTENT encoding
instruction.
The expanded name of a top-level NamedType subject to an ATTRIBUTE
encoding instruction MUST be distinct from the expanded name of every
other top-level NamedType subject to an ATTRIBUTE encoding
instruction in the same module.
The expanded name of a top-level NamedType not subject to an
ATTRIBUTE encoding instruction MUST be distinct from the expanded
name of every other top-level NamedType not subject to an ATTRIBUTE
encoding instruction in the same module.
Aside: Two top-level components may have the same expanded name if
one of them is an attribute component and the other is not.
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. The ATTRIBUTE Encoding Instruction</span>
The ATTRIBUTE encoding instruction causes an RXER encoder to encode a
value of the component to which it is applied as an XML attribute
instead of as a child element.
The notation for an ATTRIBUTE encoding instruction is defined as
follows:
AttributeInstruction ::= "ATTRIBUTE"
The base type of the type of a NamedType that is subject to an
ATTRIBUTE encoding instruction SHALL NOT be:
(1) a CHOICE, SET, or SET OF type, or
(2) a SEQUENCE type other than the one defining the QName type from
the AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] (i.e., QName is
allowed), or
(3) a SEQUENCE OF type where the SequenceOfType is not subject to a
LIST encoding instruction, or
(4) an open type.
<span class="grey">Legg Experimental [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Example
PersonalDetails ::= SEQUENCE {
firstName [ATTRIBUTE] UTF8String,
middleName [ATTRIBUTE] UTF8String,
surname [ATTRIBUTE] UTF8String
}
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. The ATTRIBUTE-REF Encoding Instruction</span>
The ATTRIBUTE-REF encoding instruction causes an RXER encoder to
encode a value of the component to which it is applied as an XML
attribute instead of as a child element, where the attribute's name
is a qualified name of the attribute declaration referenced by the
encoding instruction. In addition, the ATTRIBUTE-REF encoding
instruction causes values of the UTF8String type to be restricted to
conform to the type of the attribute declaration.
The notation for an ATTRIBUTE-REF encoding instruction is defined as
follows:
AttributeRefInstruction ::=
"ATTRIBUTE-REF" QNameValue RefParameters
Taken together, the QNameValue and the ContextParameter in the
RefParameters (if present) MUST reference an XML Schema attribute
declaration or a top-level NamedType that is subject to an ATTRIBUTE
encoding instruction.
The type of a referenced XML Schema attribute declaration SHALL NOT
be, either directly or by derivation, the XML Schema type QName,
NOTATION, ENTITY, ENTITIES, or anySimpleType.
Aside: Values of these types require information from the context
of the attribute for interpretation. Because an ATTRIBUTE-REF
encoding instruction is restricted to prefixing the ASN.1
UTF8String type, there is no mechanism to capture such context.
The type of a referenced top-level NamedType SHALL NOT be, either
directly or by subtyping, the QName type from the
AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>].
The Type in the EncodingPrefixedType for an ATTRIBUTE-REF encoding
instruction SHALL be either:
(1) the UTF8String type, or
<span class="grey">Legg Experimental [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(2) a BuiltinType that is a PrefixedType that is a TaggedType where
the Type in the TaggedType is one of (1) to (3), or
(3) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (1) to (3) and the EncodingPrefix in the
EncodingPrefixedType does not contain a reference encoding
instruction.
The identifier of a NamedType subject to an ATTRIBUTE-REF encoding
instruction does not contribute to the name of attributes in an RXER
encoding. For the sake of consistency, the identifier SHOULD, where
possible, be the same as the local name of the referenced attribute
declaration.
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. The COMPONENT-REF Encoding Instruction</span>
The ASN.1 basic notation does not have a concept of a top-level
NamedType and therefore does not have a mechanism to reference a
top-level NamedType. The COMPONENT-REF encoding instruction provides
a way to specify that a NamedType within a combining type definition
is equivalent to a referenced top-level NamedType.
The notation for a COMPONENT-REF encoding instruction is defined as
follows:
ComponentRefInstruction ::= "COMPONENT-REF" ComponentReference
ComponentReference ::=
InternalComponentReference |
ExternalComponentReference
InternalComponentReference ::= identifier FromModule ?
FromModule ::= "FROM" GlobalModuleReference
ExternalComponentReference ::= modulereference "." identifier
The GlobalModuleReference production is defined by the ASN.1 basic
notation [<a href="#ref-X.680">X.680</a>]. If the GlobalModuleReference is absent from an
InternalComponentReference, then the identifier MUST be the
identifier of a top-level NamedType in the same module. If the
GlobalModuleReference is present in an InternalComponentReference,
then the identifier MUST be the identifier of a top-level NamedType
in the referenced module.
<span class="grey">Legg Experimental [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The modulereference in an ExternalComponentReference is used in the
same way as a modulereference in an ExternalTypeReference. The
identifier in an ExternalComponentReference MUST be the identifier of
a top-level NamedType in the referenced module.
The Type in the EncodingPrefixedType for a COMPONENT-REF encoding
instruction SHALL be either:
(1) a ReferencedType that is a DefinedType that is a typereference
(not a DummyReference) or an ExternalTypeReference, or
(2) a BuiltinType or ReferencedType that is one of the productions in
Table 1 in <a href="#section-5">Section 5</a> of the specification for RXER [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>], or
(3) a BuiltinType that is a PrefixedType that is a TaggedType where
the Type in the TaggedType is one of (1) to (4), or
(4) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (1) to (4) and the EncodingPrefix in the
EncodingPrefixedType does not contain a reference encoding
instruction.
The restrictions on the use of RXER encoding instructions are such
that no other RXER encoding instruction is permitted within a
NamedType if the NamedType is subject to a COMPONENT-REF encoding
instruction.
The Type in the top-level NamedType referenced by the COMPONENT-REF
encoding instruction MUST be either:
(a) if the preceding case (1) is used, a ReferencedType that is a
DefinedType that is a typereference or ExternalTypeReference that
references the same type as the DefinedType in case (1), or
(b) if the preceding case (2) is used, a BuiltinType or
ReferencedType that is the same as the BuiltinType or
ReferencedType in case (2), or
(c) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (a) to (c), and the EncodingPrefix in the
EncodingPrefixedType contains an RXER encoding instruction.
In principle, the COMPONENT-REF encoding instruction creates a
notional NamedType where the expanded name is that of the referenced
top-level NamedType and the Type in case (1) or (2) is substituted by
the Type of the referenced top-level NamedType.
<span class="grey">Legg Experimental [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
In practice, it is sufficient for non-RXER encoders and decoders to
use the original NamedType rather than the notional NamedType because
the Type in case (1) or (2) can only differ from the Type of the
referenced top-level NamedType by having fewer RXER encoding
instructions, and RXER encoding instructions are ignored by non-RXER
encoders and decoders.
Although any prefixes for the Type in case (1) or (2) would be
bypassed, it is sufficient for RXER encoders and decoders to use the
referenced top-level NamedType instead of the notional NamedType
because these prefixes cannot be RXER encoding instructions (except,
of course, for the COMPONENT-REF encoding instruction) and can have
no effect on an RXER encoding.
Example
Modules ::= SEQUENCE OF
module [COMPONENT-REF module
FROM AbstractSyntaxNotation-X
{ 1 3 6 1 4 1 21472 1 0 1 }]
ModuleDefinition
Note that the "module" top-level NamedType in the
AbstractSyntaxNotation-X module is defined like so:
COMPONENT module ModuleDefinition
The ASN.X translation of the SEQUENCE OF type definition provides
a more natural representation:
<namedType xmlns:asnx="urn:ietf:params:xml:ns:asnx"
name="Modules">
<sequenceOf>
<element ref="asnx:module"/>
</sequenceOf>
</namedType>
Aside: The <namedType> element in ASN.X corresponds to a
TypeAssignment, not a NamedType.
The identifier of a NamedType subject to a COMPONENT-REF encoding
instruction does not contribute to an RXER encoding. For the sake of
consistency with other encoding rules, the identifier SHOULD be the
same as the identifier in the ComponentRefInstruction.
<span class="grey">Legg Experimental [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. The ELEMENT-REF Encoding Instruction</span>
The ELEMENT-REF encoding instruction causes an RXER encoder to encode
a value of the component to which it is applied as an element where
the element's name is a qualified name of the element declaration
referenced by the encoding instruction. In addition, the ELEMENT-REF
encoding instruction causes values of the Markup ASN.1 type to be
restricted to conform to the type of the element declaration.
The notation for an ELEMENT-REF encoding instruction is defined as
follows:
ElementRefInstruction ::= "ELEMENT-REF" QNameValue RefParameters
Taken together, the QNameValue and the ContextParameter in the
RefParameters (if present) MUST reference an XML Schema element
declaration, a RELAX NG element definition, or a top-level NamedType
that is not subject to an ATTRIBUTE encoding instruction.
A referenced XML Schema element declaration MUST NOT have a type that
requires the presence of values for the XML Schema ENTITY or ENTITIES
types.
Aside: Entity declarations are not supported by CRXER.
Example
AnySchema ::= CHOICE {
module [ELEMENT-REF {
namespace-name
"urn:ietf:params:xml:ns:asnx",
local-name "module" }]
Markup,
schema [ELEMENT-REF {
namespace-name
"<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>",
local-name "schema" }]
Markup,
grammar [ELEMENT-REF {
namespace-name
"<a href="http://relaxng.org/ns/structure/1.0">http://relaxng.org/ns/structure/1.0</a>",
local-name "grammar" }]
Markup
}
The ASN.X translation of the choice type definition provides a
more natural representation:
<span class="grey">Legg Experimental [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<namedType xmlns:asnx="urn:ietf:params:xml:ns:asnx"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:rng="http://relaxng.org/ns/structure/1.0"
name="AnySchema">
<choice>
<element ref="asnx:module" embedded="true"/>
<element ref="xs:schema" embedded="true"/>
<element ref="rng:grammar" embedded="true"/>
</choice>
</namedType>
The identifier of a NamedType subject to an ELEMENT-REF encoding
instruction does not contribute to the name of an element in an RXER
encoding. For the sake of consistency, the identifier SHOULD, where
possible, be the same as the local name of the referenced element
declaration.
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. The LIST Encoding Instruction</span>
The LIST encoding instruction causes an RXER encoder to encode a
value of a SEQUENCE OF type as a white-space-separated list of the
component values.
The notation for a LIST encoding instruction is defined as follows:
ListInstruction ::= "LIST"
The Type in an EncodingPrefixedType for a LIST encoding instruction
SHALL be either:
(1) a BuiltinType that is a SequenceOfType of the
"SEQUENCE OF NamedType" form, or
(2) a ConstrainedType that is a TypeWithConstraint of the
"SEQUENCE Constraint OF NamedType" form or
"SEQUENCE SizeConstraint OF NamedType" form, or
(3) a ConstrainedType that is not a TypeWithConstraint where the Type
in the ConstrainedType is one of (1) to (5), or
(4) a BuiltinType that is a PrefixedType that is a TaggedType where
the Type in the TaggedType is one of (1) to (5), or
(5) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (1) to (5).
<span class="grey">Legg Experimental [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The effect of this condition is to force the LIST encoding
instruction to be textually co-located with the SequenceOfType or
TypeWithConstraint to which it applies.
Aside: This makes it clear to a reader that the encoding
instruction applies to every use of the type no matter how it
might be referenced.
The SequenceOfType in case (1) and the TypeWithConstraint in case (2)
are said to be "subject to" the LIST encoding instruction.
A SequenceOfType or TypeWithConstraint SHALL NOT be subject to more
than one LIST encoding instruction.
The base type of the component type of a SequenceOfType or
TypeWithConstraint that is subject to a LIST encoding instruction
MUST be one of the following:
(1) the BOOLEAN, INTEGER, ENUMERATED, REAL, OBJECT IDENTIFIER,
RELATIVE-OID, GeneralizedTime, or UTCTime type, or
(2) the NCName, AnyURI, Name, or QName type from the
AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>].
Aside: While it would be feasible to allow the component type to
also be any character string type that is constrained such that
all its abstract values have a length greater than zero and none
of its abstract values contain any white space characters, testing
whether this condition is satisfied can be quite involved. For
the sake of simplicity, only certain immediately useful
constrained UTF8String types, which are known to be suitable, are
permitted (i.e., NCName, AnyURI, and Name).
The NamedType in a SequenceOfType or TypeWithConstraint that is
subject to a LIST encoding instruction MUST NOT be subject to an
ATTRIBUTE, ATTRIBUTE-REF, COMPONENT-REF, GROUP, ELEMENT-REF,
REF-AS-ELEMENT, SIMPLE-CONTENT, or TYPE-AS-VERSION encoding
instruction.
Example
UpdateTimes ::= [LIST] SEQUENCE OF updateTime GeneralizedTime
<span class="grey">Legg Experimental [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. The NAME Encoding Instruction</span>
The NAME encoding instruction causes an RXER encoder to use a
nominated character string instead of a component's identifier
wherever that identifier would otherwise appear in the encoding
(e.g., as an element or attribute name).
The notation for a NAME encoding instruction is defined as follows:
NameInstruction ::= "NAME" "AS"? NCNameValue
Example
CHOICE {
foo-att [ATTRIBUTE] [NAME AS "Foo"] INTEGER,
foo-elem [NAME "Foo"] INTEGER
}
<span class="h2"><a class="selflink" id="section-14" href="#section-14">14</a>. The REF-AS-ELEMENT Encoding Instruction</span>
The REF-AS-ELEMENT encoding instruction causes an RXER encoder to
encode a value of the component to which it is applied as an element
where the element's name is the name of the external DTD subset
element type declaration referenced by the encoding instruction. In
addition, the REF-AS-ELEMENT encoding instruction causes values of
the Markup ASN.1 type to be restricted to conform to the content and
attributes permitted by that element type declaration and its
associated attribute-list declarations.
The notation for a REF-AS-ELEMENT encoding instruction is defined as
follows:
RefAsElementInstruction ::=
"REF-AS-ELEMENT" NameValue Namespace ? RefParameters
Namespace ::= "NAMESPACE" AnyURIValue
Taken together, the NameValue and the ContextParameter in the
RefParameters (if present) MUST reference an element type declaration
in an external DTD subset that is conformant with Namespaces in XML
1.0 [<a href="#ref-XMLNS10" title=""Namespaces in XML 1.0 (Second Edition)"">XMLNS10</a>].
The Namespace is present if and only if the Name of the referenced
element type declaration conforms to a PrefixedName (a QName)
[<a href="#ref-XMLNS10" title=""Namespaces in XML 1.0 (Second Edition)"">XMLNS10</a>], in which case the Namespace specifies the namespace name
to be associated with the Prefix of the PrefixedName.
<span class="grey">Legg Experimental [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The referenced element type declaration MUST NOT require the presence
of attributes of type ENTITY or ENTITIES.
Aside: Entity declarations are not supported by CRXER.
Example
Suppose that the following external DTD subset has been defined
with a system identifier of "http://www.example.com/inventory":
<?xml version='1.0'?>
<!ELEMENT product EMPTY>
<!ATTLIST product
name CDATA #IMPLIED
partNumber CDATA #REQUIRED
quantity CDATA #REQUIRED >
The product element type declaration can be referenced as an
element in an ASN.1 type definition:
CHOICE {
product [REF-AS-ELEMENT "product"
CONTEXT "http://www.example.com/inventory"]
Markup
}
Here is the ASN.X translation of this ASN.1 type definition:
<type>
<choice>
<element elementType="product"
context="http://www.example.com/inventory"/>
</choice>
</type>
The identifier of a NamedType subject to a REF-AS-ELEMENT encoding
instruction does not contribute to the name of an element in an RXER
encoding. For the sake of consistency, the identifier SHOULD, where
possible, be the same as the Name of the referenced element type
declaration (or the LocalPart if the Name conforms to a
PrefixedName).
<span class="h2"><a class="selflink" id="section-15" href="#section-15">15</a>. The REF-AS-TYPE Encoding Instruction</span>
The REF-AS-TYPE encoding instruction causes values of the Markup
ASN.1 type to be restricted to conform to the content and attributes
permitted by a nominated element type declaration and its associated
attribute-list declarations in an external DTD subset.
<span class="grey">Legg Experimental [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The notation for a REF-AS-TYPE encoding instruction is defined as
follows:
RefAsTypeInstruction ::= "REF-AS-TYPE" NameValue RefParameters
Taken together, the NameValue and the ContextParameter of the
RefParameters (if present) MUST reference an element type declaration
in an external DTD subset that is conformant with Namespaces in XML
1.0 [<a href="#ref-XMLNS10" title=""Namespaces in XML 1.0 (Second Edition)"">XMLNS10</a>].
The referenced element type declaration MUST NOT require the presence
of attributes of type ENTITY or ENTITIES.
Aside: Entity declarations are not supported by CRXER.
Example
The product element type declaration can be referenced as a type
in an ASN.1 definition:
SEQUENCE OF
inventoryItem
[REF-AS-TYPE "product"
CONTEXT "http://www.example.com/inventory"]
Markup
Here is the ASN.X translation of this definition:
<sequenceOf>
<element name="inventoryItem">
<type elementType="product"
context="http://www.example.com/inventory"/>
</element>
</sequenceOf>
Note that when an element type declaration is referenced as a
type, the Name of the element type declaration does not contribute
to RXER encodings. For example, child elements in the RXER
encoding of values of the above SEQUENCE OF type would resemble
the following:
<inventoryItem name="hammer" partNumber="1543" quantity="29"/>
<span class="grey">Legg Experimental [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="section-16" href="#section-16">16</a>. The SCHEMA-IDENTITY Encoding Instruction</span>
The SCHEMA-IDENTITY encoding instruction associates a unique
identifier, a URI [<a href="#ref-URI" title=""Uniform Resource Identifiers (URI): Generic Syntax"">URI</a>], with the ASN.1 module containing the
encoding instruction. This encoding instruction has no effect on an
RXER encoder but does have an effect on the translation of an ASN.1
specification into an ASN.X representation.
The notation for a SCHEMA-IDENTITY encoding instruction is defined as
follows:
SchemaIdentityInstruction ::= "SCHEMA-IDENTITY" AnyURIValue
The character string specified by the AnyURIValue of each
SCHEMA-IDENTITY encoding instruction MUST be distinct. In
particular, successive versions of an ASN.1 module must each have a
different schema identity URI value.
<span class="h2"><a class="selflink" id="section-17" href="#section-17">17</a>. The SIMPLE-CONTENT Encoding Instruction</span>
The SIMPLE-CONTENT encoding instruction causes an RXER encoder to
encode a value of a component of a SEQUENCE or SET type without
encapsulation in a child element.
The notation for a SIMPLE-CONTENT encoding instruction is defined as
follows:
SimpleContentInstruction ::= "SIMPLE-CONTENT"
A NamedType subject to a SIMPLE-CONTENT encoding instruction SHALL be
in a ComponentType in a ComponentTypeList in a RootComponentTypeList.
At most one such NamedType of a SEQUENCE or SET type is permitted to
be subject to a SIMPLE-CONTENT encoding instruction. If any
component is subject to a SIMPLE-CONTENT encoding instruction, then
all other components in the same SEQUENCE or SET type definition MUST
be attribute components. These tests are applied after the
COMPONENTS OF transformation specified in X.680, Clause 24.4 [<a href="#ref-X.680">X.680</a>].
Aside: Child elements and simple content are mutually exclusive.
Specification writers should note that use of the SIMPLE-CONTENT
encoding instruction on a component of an extensible SEQUENCE or
SET type means that all future extensions to the SEQUENCE or SET
type are restricted to being attribute components with the limited
set of types that are permitted for attribute components. Using
an ATTRIBUTE encoding instruction instead of a SIMPLE-CONTENT
encoding instruction avoids this limitation.
<span class="grey">Legg Experimental [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The base type of the type of a NamedType that is subject to a
SIMPLE-CONTENT encoding instruction SHALL NOT be:
(1) a SET or SET OF type, or
(2) a CHOICE type where the ChoiceType is not subject to a UNION
encoding instruction, or
(3) a SEQUENCE type other than the one defining the QName type from
the AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] (i.e., QName is
allowed), or
(4) a SEQUENCE OF type where the SequenceOfType is not subject to a
LIST encoding instruction, or
(5) an open type.
If the type of a NamedType subject to a SIMPLE-CONTENT encoding
instruction has abstract values with an empty character data
translation [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] (i.e., an empty encoding), then the NamedType
SHALL NOT be marked OPTIONAL or DEFAULT.
Example
SEQUENCE {
units [ATTRIBUTE] UTF8String,
amount [SIMPLE-CONTENT] INTEGER
}
<span class="h2"><a class="selflink" id="section-18" href="#section-18">18</a>. The TARGET-NAMESPACE Encoding Instruction</span>
The TARGET-NAMESPACE encoding instruction associates an XML namespace
name [<a href="#ref-XMLNS10" title=""Namespaces in XML 1.0 (Second Edition)"">XMLNS10</a>], a URI [<a href="#ref-URI" title=""Uniform Resource Identifiers (URI): Generic Syntax"">URI</a>], with the type, object class, value,
object, and object set references defined in the ASN.1 module
containing the encoding instruction. In addition, it associates the
namespace name with each top-level NamedType in the RXER encoding
control section.
The notation for a TARGET-NAMESPACE encoding instruction is defined
as follows:
TargetNamespaceInstruction ::=
"TARGET-NAMESPACE" AnyURIValue Prefix ?
Prefix ::= "PREFIX" NCNameValue
The AnyURIValue SHALL NOT specify an empty string.
<span class="grey">Legg Experimental [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Definition (target namespace): If an ASN.1 module contains a
TARGET-NAMESPACE encoding instruction, then the target namespace of
the module is the character string specified by the AnyURIValue of
the TARGET-NAMESPACE encoding instruction; otherwise, the target
namespace of the module is said to be absent.
Two or more ASN.1 modules MAY have the same non-absent target
namespace if and only if the expanded names of the top-level
attribute components are distinct across all those modules, the
expanded names of the top-level element components are distinct
across all those modules, and the defined type, object class, value,
object, and object set references are distinct in their category
across all those modules.
The Prefix, if present, suggests an NCName to use as the namespace
prefix in namespace declarations involving the target namespace. An
RXER encoder is not obligated to use the nominated namespace prefix.
If there are no top-level components, then the RXER encodings
produced using a module with a TARGET-NAMESPACE encoding instruction
are backward compatible with the RXER encodings produced by the same
module without the TARGET-NAMESPACE encoding instruction.
<span class="h2"><a class="selflink" id="section-19" href="#section-19">19</a>. The TYPE-AS-VERSION Encoding Instruction</span>
The TYPE-AS-VERSION encoding instruction causes an RXER encoder to
include an xsi:type attribute in the encoding of a value of the
component to which the encoding instruction is applied. This
attribute allows an XML Schema [<a href="#ref-XSD1" title=""XML Schema Part 1: Structures Second Edition"">XSD1</a>] validator to select, if
available, the appropriate XML Schema translation for the version of
the ASN.1 specification used to create the encoding.
Aside: Translations of an ASN.1 specification into a compatible
XML Schema are expected to be slightly different across versions
because of progressive extensions to the ASN.1 specification. Any
incompatibilities between these translations can be accommodated
if each version uses a different target namespace. The target
namespace will be evident in the value of the xsi:type attribute
and will cause an XML Schema validator to use the appropriate
version. This mechanism also accommodates an ASN.1 type that is
renamed in a later version of the ASN.1 specification.
The notation for a TYPE-AS-VERSION encoding instruction is defined as
follows:
TypeAsVersionInstruction ::= "TYPE-AS-VERSION"
<span class="grey">Legg Experimental [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The Type in a NamedType that is subject to a TYPE-AS-VERSION encoding
instruction MUST be a namespace-qualified reference [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>].
The addition of a TYPE-AS-VERSION encoding instruction does not
affect the backward compatibility of RXER encodings.
Aside: In a translation of an ASN.1 specification into XML Schema,
any Type in a NamedType that is subject to a TYPE-AS-VERSION
encoding instruction is expected to be translated into the
XML Schema anyType so that the xsi:type attribute acts as a switch
to select the appropriate version.
<span class="h2"><a class="selflink" id="section-20" href="#section-20">20</a>. The TYPE-REF Encoding Instruction</span>
The TYPE-REF encoding instruction causes values of the Markup ASN.1
type to be restricted to conform to a specific XML Schema named type,
RELAX NG named pattern or an ASN.1 defined type.
Aside: Referencing an ASN.1 type in a TYPE-REF encoding
instruction does not have the effect of imposing a requirement to
preserve the Infoset [<a href="#ref-INFOSET" title=""XML Information Set (Second Edition)"">INFOSET</a>] representation of the RXER encoding
of an abstract value of the type. It is still sufficient to
preserve just the abstract value.
The notation for a TYPE-REF encoding instruction is defined as
follows:
TypeRefInstruction ::= "TYPE-REF" QNameValue RefParameters
Taken together, the QNameValue and the ContextParameter of the
RefParameters (if present) MUST reference an XML Schema named type, a
RELAX NG named pattern, or an ASN.1 defined type.
A referenced XML Schema type MUST NOT require the presence of values
for the XML Schema ENTITY or ENTITIES types.
Aside: Entity declarations are not supported by CRXER.
The QNameValue SHALL NOT be a direct reference to the XML Schema
NOTATION type [<a href="#ref-XSD2" title=""XML Schema Part 2: Datatypes Second Edition"">XSD2</a>] (i.e., the namespace name
"<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>" and local name "NOTATION");
however, a reference to an XML Schema type derived from the NOTATION
type is permitted.
Aside: This restriction is to ensure that the lexical space [<a href="#ref-XSD2" title=""XML Schema Part 2: Datatypes Second Edition"">XSD2</a>]
of the referenced type is actually populated with the names of
notations [<a href="#ref-XSD1" title=""XML Schema Part 1: Structures Second Edition"">XSD1</a>].
<span class="grey">Legg Experimental [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Example
MyDecimal ::=
[TYPE-REF {
namespace-name "<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>",
local-name "decimal" }]
Markup
Note that the ASN.X translation of this ASN.1 type definition
provides a more natural way to reference the XML Schema decimal
type:
<namedType xmlns:xs="http://www.w3.org/2001/XMLSchema"
name="MyDecimal">
<type ref="xs:decimal" embedded="true"/>
</namedType>
<span class="h2"><a class="selflink" id="section-21" href="#section-21">21</a>. The UNION Encoding Instruction</span>
The UNION encoding instruction causes an RXER encoder to encode the
value of an alternative of a CHOICE type without encapsulation in a
child element. The chosen alternative is optionally indicated with a
member attribute. The optional PrecedenceList also allows a
specification writer to alter the order in which an RXER decoder will
consider the alternatives of the CHOICE as it determines which
alternative has been used (if the actual alternative has not been
specified through the member attribute).
The notation for a UNION encoding instruction is defined as follows:
UnionInstruction ::= "UNION" AlternativesPrecedence ?
AlternativesPrecedence ::= "PRECEDENCE" PrecedenceList
PrecedenceList ::= identifier PrecedenceList ?
The Type in the EncodingPrefixedType for a UNION encoding instruction
SHALL be either:
(1) a BuiltinType that is a ChoiceType, or
(2) a ConstrainedType that is not a TypeWithConstraint where the Type
in the ConstrainedType is one of (1) to (4), or
(3) a BuiltinType that is a PrefixedType that is a TaggedType where
the Type in the TaggedType is one of (1) to (4), or
<span class="grey">Legg Experimental [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(4) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (1) to (4).
The ChoiceType in case (1) is said to be "subject to" the UNION
encoding instruction.
The base type of the type of each alternative of a ChoiceType that is
subject to a UNION encoding instruction SHALL NOT be:
(1) a CHOICE, SET, or SET OF type, or
(2) a SEQUENCE type other than the one defining the QName type from
the AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>] (i.e., QName is
allowed), or
(3) a SEQUENCE OF type where the SequenceOfType is not subject to a
LIST encoding instruction, or
(4) an open type.
Each identifier in the PrecedenceList MUST be the identifier of a
NamedType in the ChoiceType.
A particular identifier SHALL NOT appear more than once in the same
PrecedenceList.
Every NamedType in a ChoiceType that is subject to a UNION encoding
instruction MUST NOT be subject to an ATTRIBUTE, ATTRIBUTE-REF,
COMPONENT-REF, GROUP, ELEMENT-REF, REF-AS-ELEMENT, SIMPLE-CONTENT, or
TYPE-AS-VERSION encoding instruction.
Example
[UNION PRECEDENCE basicName] CHOICE {
extendedName UTF8String,
basicName PrintableString
}
<span class="h2"><a class="selflink" id="section-22" href="#section-22">22</a>. The VALUES Encoding Instruction</span>
The VALUES encoding instruction causes an RXER encoder to use
nominated names instead of the identifiers that would otherwise
appear in the encoding of a value of a BIT STRING, ENUMERATED, or
INTEGER type.
<span class="grey">Legg Experimental [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The notation for a VALUES encoding instruction is defined as follows:
ValuesInstruction ::=
"VALUES" AllValuesMapped ? ValueMappingList ?
AllValuesMapped ::= AllCapitalized | AllUppercased
AllCapitalized ::= "ALL" "CAPITALIZED"
AllUppercased ::= "ALL" "UPPERCASED"
ValueMappingList ::= ValueMapping ValueMappingList ?
ValueMapping ::= "," identifier "AS" NCNameValue
The Type in the EncodingPrefixedType for a VALUES encoding
instruction SHALL be either:
(1) a BuiltinType that is a BitStringType with a NamedBitList, or
(2) a BuiltinType that is an EnumeratedType, or
(3) a BuiltinType that is an IntegerType with a NamedNumberList, or
(4) a ConstrainedType that is not a TypeWithConstraint where the Type
in the ConstrainedType is one of (1) to (6), or
(5) a BuiltinType that is a PrefixedType that is a TaggedType where
the Type in the TaggedType is one of (1) to (6), or
(6) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (1) to (6).
The effect of this condition is to force the VALUES encoding
instruction to be textually co-located with the type definition to
which it applies.
The BitStringType, EnumeratedType, or IntegerType in case (1), (2),
or (3), respectively, is said to be "subject to" the VALUES encoding
instruction.
A BitStringType, EnumeratedType, or IntegerType SHALL NOT be subject
to more than one VALUES encoding instruction.
Each identifier in a ValueMapping MUST be an identifier appearing in
the NamedBitList, Enumerations, or NamedNumberList, as the case may
be.
<span class="grey">Legg Experimental [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The identifier in a ValueMapping SHALL NOT be the same as the
identifier in any other ValueMapping for the same ValueMappingList.
Definition (replacement name): Each identifier in a BitStringType,
EnumeratedType, or IntegerType subject to a VALUES encoding
instruction has a replacement name. If there is a ValueMapping for
the identifier, then the replacement name is the character string
specified by the NCNameValue in the ValueMapping; else if
AllCapitalized is used, then the replacement name is the identifier
with the first character uppercased; else if AllUppercased is used,
then the replacement name is the identifier with all its characters
uppercased; otherwise, the replacement name is the identifier.
The replacement names for the identifiers in a BitStringType subject
to a VALUES encoding instruction MUST be distinct.
The replacement names for the identifiers in an EnumeratedType
subject to a VALUES encoding instruction MUST be distinct.
The replacement names for the identifiers in an IntegerType subject
to a VALUES encoding instruction MUST be distinct.
Example
Traffic-Light ::= [VALUES ALL CAPITALIZED, red AS "RED"]
ENUMERATED {
red, -- Replacement name is RED.
amber, -- Replacement name is Amber.
green -- Replacement name is Green.
}
<span class="h2"><a class="selflink" id="section-23" href="#section-23">23</a>. Insertion Encoding Instructions</span>
Certain of the RXER encoding instructions are categorized as
insertion encoding instructions. The insertion encoding instructions
are the NO-INSERTIONS, HOLLOW-INSERTIONS, SINGULAR-INSERTIONS,
UNIFORM-INSERTIONS, and MULTIFORM-INSERTIONS encoding instructions
(whose notations are described respectively by
NoInsertionsInstruction, HollowInsertionsInstruction,
SingularInsertionsInstruction, UniformInsertionsInstruction, and
MultiformInsertionsInstruction).
The notation for the insertion encoding instructions is defined as
follows:
<span class="grey">Legg Experimental [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
InsertionsInstruction ::=
NoInsertionsInstruction |
HollowInsertionsInstruction |
SingularInsertionsInstruction |
UniformInsertionsInstruction |
MultiformInsertionsInstruction
NoInsertionsInstruction ::= "NO-INSERTIONS"
HollowInsertionsInstruction ::= "HOLLOW-INSERTIONS"
SingularInsertionsInstruction ::= "SINGULAR-INSERTIONS"
UniformInsertionsInstruction ::= "UNIFORM-INSERTIONS"
MultiformInsertionsInstruction ::= "MULTIFORM-INSERTIONS"
Using the GROUP encoding instruction on components with extensible
types can lead to situations where an unknown extension could be
associated with more than one extension insertion point. The
insertion encoding instructions remove this ambiguity by limiting the
form that extensions can take. That is, the insertion encoding
instructions indicate what extensions can be made to an ASN.1
specification without breaking forward compatibility for RXER
encodings.
Aside: Forward compatibility means the ability for a decoder to
successfully decode an encoding containing extensions introduced
into a version of the specification that is more recent than the
one used by the decoder.
In the most general case, an extension to a CHOICE, SET, or SEQUENCE
type will generate zero or more attributes and zero or more elements,
due to the potential use of the GROUP and ATTRIBUTE encoding
instructions by the extension.
The MULTIFORM-INSERTIONS encoding instruction indicates that the RXER
encodings produced by forward-compatible extensions to a type will
always consist of one or more elements and zero or more attributes.
No restriction is placed on the names of the elements.
Aside: Of necessity, the names of the attributes will all be
different in any given encoding.
The UNIFORM-INSERTIONS encoding instruction indicates that the RXER
encodings produced by forward-compatible extensions to a type will
always consist of one or more elements having the same expanded name,
and zero or more attributes. The expanded name shared by the
<span class="grey">Legg Experimental [Page 30]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
elements in one particular encoding is not required to be the same as
the expanded name shared by the elements in any other encoding of the
extension. For example, in one encoding of the extension the
elements might all be called "foo", while in another encoding of the
extension they might all be called "bar".
The SINGULAR-INSERTIONS encoding instruction indicates that the RXER
encodings produced by forward-compatible extensions to a type will
always consist of a single element and zero or more attributes. The
name of the single element is not required to be the same in every
possible encoding of the extension.
The HOLLOW-INSERTIONS encoding instruction indicates that the RXER
encodings produced by forward-compatible extensions to a type will
always consist of zero elements and zero or more attributes.
The NO-INSERTIONS encoding instruction indicates that no forward-
compatible extensions can be made to a type.
Examples of forward-compatible extensions are provided in <a href="#appendix-C">Appendix C</a>.
The Type in the EncodingPrefixedType for an insertion encoding
instruction SHALL be either:
(1) a BuiltinType that is a ChoiceType where the ChoiceType is not
subject to a UNION encoding instruction, or
(2) a BuiltinType that is a SequenceType or SetType, or
(3) a ConstrainedType that is not a TypeWithConstraint where the Type
in the ConstrainedType is one of (1) to (5), or
(4) a BuiltinType that is a PrefixedType that is a TaggedType where
the Type in the TaggedType is one of (1) to (5), or
(5) a BuiltinType that is a PrefixedType that is an
EncodingPrefixedType where the Type in the EncodingPrefixedType
is one of (1) to (5).
Case (2) is not permitted when the insertion encoding instruction is
the SINGULAR-INSERTIONS, UNIFORM-INSERTIONS, or MULTIFORM-INSERTIONS
encoding instruction.
<span class="grey">Legg Experimental [Page 31]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Aside: Because extensions to a SET or SEQUENCE type are serial and
effectively optional, the SINGULAR-INSERTIONS, UNIFORM-INSERTIONS,
and MULTIFORM-INSERTIONS encoding instructions offer no advantage
over unrestricted extensions (for a SET or SEQUENCE). For
example, an optional series of singular insertions generates zero
or more elements and zero or more attributes, just like an
unrestricted extension.
The Type in case (1) or case (2) is said to be "subject to" the
insertion encoding instruction.
The Type in case (1) or case (2) MUST be extensible, either
explicitly or by default.
A Type SHALL NOT be subject to more than one insertion encoding
instruction.
The insertion encoding instructions indicate what kinds of extensions
can be made to a type without breaking forward compatibility, but
they do not prohibit extensions that do break forward compatibility.
That is, it is not an error for a type's base type to contain
extensions that do not satisfy an insertion encoding instruction
affecting the type. However, if any such extensions are made, then a
new value SHOULD be introduced into the extensible set of permitted
values for a version indicator attribute, or attributes (see
<a href="#section-24">Section 24</a>), whose scope encompasses the extensions. An example is
provided in <a href="#appendix-C">Appendix C</a>.
<span class="h2"><a class="selflink" id="section-24" href="#section-24">24</a>. The VERSION-INDICATOR Encoding Instruction</span>
The VERSION-INDICATOR encoding instruction provides a mechanism for
RXER decoders to be alerted that an encoding contains extensions that
break forward compatibility (see the preceding section).
The notation for a VERSION-INDICATOR encoding instruction is defined
as follows:
VersionIndicatorInstruction ::= "VERSION-INDICATOR"
A NamedType that is subject to a VERSION-INDICATOR encoding
instruction MUST also be subject to an ATTRIBUTE encoding
instruction.
The type of the NamedType that is subject to the VERSION-INDICATOR
encoding instruction MUST be directly or indirectly a constrained
type where the set of permitted values is defined to be extensible.
Each value represents a different version of the ASN.1 specification.
Ordinarily, an application will set the value of a version indicator
<span class="grey">Legg Experimental [Page 32]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
attribute to be the last of these permitted values. An application
MAY set the value of the version indicator attribute to the value
corresponding to an earlier version of the specification if it has
not used any of the extensions added in a subsequent version.
If an RXER decoder encounters a value of the type that is not one of
the root values or extension additions (but that is still allowed
since the set of permitted values is extensible), then this indicates
that the decoder is using a version of the ASN.1 specification that
is not compatible with the version used to produce the encoding. In
such cases, the decoder SHOULD treat the element containing the
attribute as having an unknown ASN.1 type.
Aside: A version indicator attribute only indicates an
incompatibility with respect to RXER encodings. Other encodings
are not affected because the GROUP encoding instruction does not
apply to them.
Examples
In this first example, the decoder is using an incompatible older
version if the value of the version attribute in a received RXER
encoding is not 1, 2, or 3.
SEQUENCE {
version [ATTRIBUTE] [VERSION-INDICATOR]
INTEGER (1, ..., 2..3),
message MessageType
}
In this second example, the decoder is using an incompatible older
version if the value of the format attribute in a received RXER
encoding is not "1.0", "1.1", or "2.0".
SEQUENCE {
format [ATTRIBUTE] [VERSION-INDICATOR]
UTF8String ("1.0", ..., "1.1" | "2.0"),
message MessageType
}
An extensive example is provided in <a href="#appendix-C">Appendix C</a>.
It is not necessary for every extensible type to have its own version
indicator attribute. It would be typical for only the types of
top-level element components to include a version indicator
attribute, which would serve as the version indicator for all of the
nested components.
<span class="grey">Legg Experimental [Page 33]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="section-25" href="#section-25">25</a>. The GROUP Encoding Instruction</span>
The GROUP encoding instruction causes an RXER encoder to encode a
value of the component to which it is applied without encapsulation
as an element. It allows the construction of non-trivial content
models for element content.
The notation for a GROUP encoding instruction is defined as follows:
GroupInstruction ::= "GROUP"
The base type of the type of a NamedType that is subject to a GROUP
encoding instruction SHALL be either:
(1) a SEQUENCE, SET, or SET OF type, or
(2) a CHOICE type where the ChoiceType is not subject to a UNION
encoding instruction, or
(3) a SEQUENCE OF type where the SequenceOfType is not subject to a
LIST encoding instruction.
The SEQUENCE type in case (1) SHALL NOT be the associated type for a
built-in type, SHALL NOT be a type from the
AdditionalBasicDefinitions module [<a href="#ref-RXER" title=""Robust XML Encoding Rules (RXER) for Abstract Syntax Notation One (ASN.1)"">RXER</a>], and SHALL NOT contain a
component that is subject to a SIMPLE-CONTENT encoding instruction.
Aside: Thus, the CHARACTER STRING, EMBEDDED PDV, EXTERNAL, REAL,
and QName types are excluded.
The CHOICE type in case (2) SHALL NOT be a type from the
AdditionalBasicDefinitions module.
Aside: Thus, the Markup type is excluded.
Definition (visible component): Ignoring all type constraints, the
visible components for a type that is directly or indirectly a
combining ASN.1 type (i.e., SEQUENCE, SET, CHOICE, SEQUENCE OF, or
SET OF) is the set of components of the combining type definition
plus, for each NamedType (of the combining type definition) that is
subject to a GROUP encoding instruction, the visible components for
the type of the NamedType. The visible components are determined
after the COMPONENTS OF transformation specified in X.680, Clause
24.4 [<a href="#ref-X.680">X.680</a>].
<span class="grey">Legg Experimental [Page 34]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Aside: The set of visible attribute and element components for a
type is the set of all the components of the type, and any nested
types, that describe attributes and child elements appearing in
the RXER encodings of values of the outer type.
A GROUP encoding instruction MUST NOT be used where it would cause a
NamedType to be a visible component of the type of that same
NamedType (which is only possible if the type definition is
recursive).
Aside: Components subject to a GROUP encoding instruction might be
translated into a compatible XML Schema [<a href="#ref-XSD1" title=""XML Schema Part 1: Structures Second Edition"">XSD1</a>] as group
definitions. A NamedType that is visible to its own type is
analogous to a circular group, which XML Schema disallows.
<a href="#section-25.1">Section 25.1</a> imposes additional conditions on the use of the GROUP
encoding instruction.
In any use of the GROUP encoding instruction, there is a type, the
including type, that contains the component subject to the GROUP
encoding instruction, and a type, the included type, that is the base
type of that component. Either type can have an extensible content
model, either by directly using ASN.1 extensibility or by including
through another GROUP encoding instruction some other type that is
extensible.
The including and included types may be defined in different ASN.1
modules, in which case the owner of the including type, i.e., the
person or organization having the authority to add extensions to the
including type's definition, may be different from the owner of the
included type.
If the owner of the including type is not using the most recent
version of the included type's definition, then the owner of the
including type might add an extension to the including type that is
valid with respect to the older version of the included type, but is
later found to be invalid when the latest versions of the including
and included type definitions are brought together (perhaps by a
third party). Although the owner of the including type must
necessarily be aware of the existence of the included type, the
reverse is not necessarily true. The owner of the included type
could add an extension to the included type without realizing that it
invalidates someone else's including type.
<span class="grey">Legg Experimental [Page 35]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
To avoid these problems, a GROUP encoding instruction MUST NOT be
used if:
(1) the included type is defined in a different module from the
including type, and
(2) the included type has an extensible content model, and
(3) changes to the included type are not coordinated with the owner
of the including type.
Changes in the included type are coordinated with the owner of the
including type if:
(1) the owner of the included type is also the owner of the including
type, or
(2) the owner of the including type is collaborating with the owner
of the included type, or
(3) all changes will be vetted by a common third party before being
approved and published.
<span class="h3"><a class="selflink" id="section-25.1" href="#section-25.1">25.1</a>. Unambiguous Encodings</span>
Unregulated use of the GROUP encoding instruction can easily lead to
specifications in which distinct abstract values have
indistinguishable RXER encodings, i.e., ambiguous encodings. This
section imposes restrictions on the use of the GROUP encoding
instruction to ensure that distinct abstract values have distinct
RXER encodings. In addition, these restrictions ensure that an
abstract value can be easily decoded in a single pass without
back-tracking.
An RXER decoder for an ASN.1 type can be abstracted as a recognizer
for a notional language, consisting of element and attribute expanded
names, where the type definition describes the grammar for that
language (in fact it is a context-free grammar). The restrictions on
a type definition to ensure easy, unambiguous decoding are more
conveniently, completely, and simply expressed as conditions on this
associated grammar. Implementations are not expected to verify type
definitions exactly in the manner to be described; however, the
procedure used MUST produce the same result.
<a href="#section-25.1.1">Section 25.1.1</a> describes the procedure for recasting as a grammar a
type definition containing components subject to the GROUP encoding
instruction. Sections <a href="#section-25.1.2">25.1.2</a> and <a href="#section-25.1.3">25.1.3</a> specify conditions that the
<span class="grey">Legg Experimental [Page 36]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
grammar must satisfy for the type definition to be valid. <a href="#section-25.1.4">Section</a>
<a href="#section-25.1.4">25.1.4</a> describes how unrecognized attributes are accepted by the
grammar for an extensible type.
Appendices A and B have extensive examples.
<span class="h4"><a class="selflink" id="section-25.1.1" href="#section-25.1.1">25.1.1</a>. Grammar Construction</span>
A grammar consists of a collection of productions. A production has
a left-hand side and a right-hand side (in this document, separated
by the "::=" symbol). The left-hand side (in a context-free grammar)
is a single non-terminal symbol. The right-hand side is a sequence
of non-terminal and terminal symbols. The terminal symbols are the
lexical items of the language that the grammar describes. One of the
non-terminals is nominated to be the start symbol. A valid sequence
of terminals for the language can be generated from the grammar by
beginning with the start symbol and repeatedly replacing any
non-terminal with the right-hand side of one of the productions where
that non-terminal is on the production's left-hand side. The final
sequence of terminals is achieved when there are no remaining
non-terminals to replace.
Aside: X.680 describes the ASN.1 basic notation using a
context-free grammar.
Each NamedType has an associated primary and secondary non-terminal.
Aside: The secondary non-terminal for a NamedType is used when the
base type of the type in the NamedType is a SEQUENCE OF type or
SET OF type.
Each ExtensionAddition and ExtensionAdditionAlternative has an
associated non-terminal. There is a non-terminal associated with the
extension insertion point of each extensible type. There is also a
primary start non-terminal (this is the start symbol) and a secondary
start non-terminal. The exact nature of the non-terminals is not
important, however all the non-terminals MUST be mutually distinct.
It is adequate for most of the examples in this document (though not
in the most general case) for the primary non-terminal for a
NamedType to be the identifier of the NamedType, for the primary
start non-terminal to be S, for the non-terminals for the instances
of ExtensionAddition and ExtensionAdditionAlternative to be E1, E2,
E3, and so on, and for the non-terminals for the extension insertion
points to be I1, I2, I3, and so on. The secondary non-terminals are
labelled by appending a "'" character to the primary non-terminal
label, e.g., the primary and secondary start non-terminals are S and
S', respectively.
<span class="grey">Legg Experimental [Page 37]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Each NamedType and extension insertion point has an associated
terminal. There exists a terminal called the general extension
terminal that is not associated with any specific notation. The
general extension terminal and the terminals for the extension
insertion points are used to represent elements in unknown
extensions. The exact nature of the terminals is not important;
however, the aforementioned terminals MUST be mutually distinct. The
terminals are further categorized as either element terminals or
attribute terminals. A terminal for a NamedType is an attribute
terminal if its associated NamedType is an attribute component;
otherwise, it is an element terminal. The general extension terminal
and the terminals for the extension insertion points are categorized
as element terminals.
Terminals for attributes in unknown extensions are not explicitly
provided in the grammar. Certain productions in the grammar are
categorized as insertion point productions, and their role in
accepting unknown attributes is described in <a href="#section-25.1.4">Section 25.1.4</a>.
In the examples in this document, the terminal for a component other
than an attribute component will be represented as the local name of
the expanded name of the component enclosed in double quotes, and the
terminal for an attribute component will be represented as the local
name of the expanded name of the component prefixed by the '@'
character and enclosed in double quotes. The general extension
terminal will be represented as "*" and the terminals for the
extension insertion points will be represented as "*1", "*2", "*3",
and so on.
The productions generated from a NamedType depend on the base type of
the type of the NamedType. The productions for the start
non-terminals depend on the combining type definition being tested.
In either case, the procedure for generating productions takes a
primary non-terminal, a secondary non-terminal (sometimes), and a
type definition.
The grammar is constructed beginning with the start non-terminals and
the combining type definition being tested.
A grammar is constructed after the COMPONENTS OF transformation
specified in X.680, Clause 24.4 [<a href="#ref-X.680">X.680</a>].
Given a primary non-terminal, N, and a type where the base type is a
SEQUENCE or SET type, a production is added to the grammar with N as
the left-hand side. The right-hand side is constructed from an
initial empty state according to the following cases considered in
order:
<span class="grey">Legg Experimental [Page 38]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(1) If an initial RootComponentTypeList is present in the base type,
then the sequence of primary non-terminals for the components
nested in that RootComponentTypeList are appended to the right-
hand side in the order of their definition.
(2) If an ExtensionAdditions instance is present in the base type and
not empty, then the non-terminal for the first ExtensionAddition
nested in the ExtensionAdditions instance is appended to the
right-hand side.
(3) If an ExtensionAdditions instance is empty or not present in the
base type, and the base type is extensible (explicitly or by
default), and the base type is not subject to a NO-INSERTIONS or
HOLLOW-INSERTIONS encoding instruction, then the non-terminal for
the extension insertion point of the base type is appended to the
right-hand side.
(4) If a final RootComponentTypeList is present in the base type,
then the primary non-terminals for the components nested in that
RootComponentTypeList are appended to the right-hand side in the
order of their definition.
The production is an insertion point production if an
ExtensionAdditions instance is empty or not present in the base type,
and the base type is extensible (explicitly or by default), and the
base type is not subject to a NO-INSERTIONS encoding instruction.
If a component in a ComponentTypeList (in either a
RootComponentTypeList or an ExtensionAdditionGroup) is marked
OPTIONAL or DEFAULT, then a production with the primary non-terminal
of the component as the left-hand side and an empty right-hand side
is added to the grammar.
If a component (regardless of the ASN.1 combining type containing it)
is subject to a GROUP encoding instruction, then one or more
productions constructed according to the component's type are added
to the grammar. Each of these productions has the primary
non-terminal of the component as the left-hand side.
If a component (regardless of the ASN.1 combining type containing it)
is not subject to a GROUP encoding instruction, then a production is
added to the grammar with the primary non-terminal of the component
as the left-hand side and the terminal of the component as the
right-hand side.
<span class="grey">Legg Experimental [Page 39]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Example
Consider the following ASN.1 type definition:
SEQUENCE {
-- Start of initial RootComponentTypeList.
one [ATTRIBUTE] UTF8String,
two BOOLEAN OPTIONAL,
three INTEGER
-- End of initial RootComponentTypeList.
}
Here is the grammar derived from this type:
S ::= one two three
one ::= "@one"
two ::= "two"
two ::=
three ::= "three"
For each ExtensionAddition (of a SEQUENCE or SET base type), a
production is added to the grammar where the left-hand side is the
non-terminal for the ExtensionAddition and the right-hand side is
initially empty. If the ExtensionAddition is a ComponentType, then
the primary non-terminal for the NamedType in the ComponentType is
appended to the right-hand side; otherwise (an
ExtensionAdditionGroup), the sequence of primary non-terminals for
the components nested in the ComponentTypeList in the
ExtensionAdditionGroup are appended to the right-hand side in the
order of their definition. If the ExtensionAddition is followed by
another ExtensionAddition, then the non-terminal for the next
ExtensionAddition is appended to the right-hand side; otherwise, if
the base type is not subject to a NO-INSERTIONS or HOLLOW-INSERTIONS
encoding instruction, then the non-terminal for the extension
insertion point of the base type is appended to the right-hand side.
If the ExtensionAddition is not followed by another ExtensionAddition
and the base type is not subject to a NO-INSERTIONS encoding
instruction, then the production is an insertion point production.
If the empty sequence of terminals cannot be generated from the
production (it may be necessary to wait until the grammar is
otherwise complete before making this determination), then another
production is added to the grammar where the left-hand side is the
non-terminal for the ExtensionAddition and the right-hand side is
empty.
Aside: An extension is always effectively optional since a sender
may be using an earlier version of the ASN.1 specification where
none, or only some, of the extensions have been defined.
<span class="grey">Legg Experimental [Page 40]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Aside: The grammar generated for ExtensionAdditions is structured
to take account of the condition that an extension can only be
used if all the earlier extensions are also used [<a href="#ref-X.680">X.680</a>].
If a SEQUENCE or SET base type is extensible (explicitly or by
default) and is not subject to a NO-INSERTIONS or HOLLOW-INSERTIONS
encoding instruction, then:
(1) a production is added to the grammar where the left-hand side is
the non-terminal for the extension insertion point of the base
type and the right-hand side is the general extension terminal
followed by the non-terminal for the extension insertion point,
and
(2) a production is added to the grammar where the left-hand side is
the non-terminal for the extension insertion point and the
right-hand side is empty.
Example
Consider the following ASN.1 type definition:
SEQUENCE {
-- Start of initial RootComponentTypeList.
one BOOLEAN,
two INTEGER OPTIONAL,
-- End of initial RootComponentTypeList.
...,
-- Start of ExtensionAdditions.
four INTEGER, -- First ExtensionAddition (E1).
five BOOLEAN OPTIONAL, -- Second ExtensionAddition (E2).
[[ -- An ExtensionAdditionGroup.
six UTF8String,
seven INTEGER OPTIONAL
]], -- Third ExtensionAddition (E3).
-- End of ExtensionAdditions.
-- The extension insertion point is here (I1).
...,
-- Start of final RootComponentTypeList.
three INTEGER
}
Here is the grammar derived from this type:
S ::= one two E1 three
E1 ::= four E2
E1 ::=
<span class="grey">Legg Experimental [Page 41]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
E2 ::= five E3
E3 ::= six seven I1
E3 ::=
I1 ::= "*" I1
I1 ::=
one ::= "one"
two ::= "two"
two ::=
three ::= "three"
four ::= "four"
five ::= "five"
five ::=
six ::= "six"
seven ::= "seven"
seven ::=
If the SEQUENCE type were subject to a NO-INSERTIONS or
HOLLOW-INSERTIONS encoding instruction, then the productions for
I1 would not appear, and the first production for E3 would be:
E3 ::= six seven
Given a primary non-terminal, N, and a type where the base type is a
CHOICE type:
(1) A production is added to the grammar for each NamedType nested in
the RootAlternativeTypeList of the base type, where the left-hand
side is N and the right-hand side is the primary non-terminal for
the NamedType.
(2) A production is added to the grammar for each
ExtensionAdditionAlternative of the base type, where the left-
hand side is N and the right-hand side is the non-terminal for
the ExtensionAdditionAlternative.
(3) If the base type is extensible (explicitly or by default) and the
base type is not subject to an insertion encoding instruction,
then:
(a) A production is added to the grammar where the left-hand side
is N and the right-hand side is the non-terminal for the
extension insertion point of the base type. This production
is an insertion point production.
<span class="grey">Legg Experimental [Page 42]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(b) A production is added to the grammar where the left-hand side
is the non-terminal for the extension insertion point of the
base type and the right-hand side is the general extension
terminal followed by the non-terminal for the extension
insertion point.
(c) A production is added to the grammar where the left-hand side
is the non-terminal for the extension insertion point of the
base type and the right-hand side is empty.
(4) If the base type is subject to a HOLLOW-INSERTIONS encoding
instruction, then a production is added to the grammar where the
left-hand side is N and the right-hand side is empty. This
production is an insertion point production.
(5) If the base type is subject to a SINGULAR-INSERTIONS encoding
instruction, then a production is added to the grammar where the
left-hand side is N and the right-hand side is the general
extension terminal. This production is an insertion point
production.
(6) If the base type is subject to a UNIFORM-INSERTIONS encoding
instruction, then:
(a) A production is added to the grammar where the left-hand side
is N and the right-hand side is the general extension
terminal.
Aside: This production is used to verify the correctness
of an ASN.1 type definition, but would not be used in the
implementation of an RXER decoder. The next production
takes precedence over it for accepting an unknown element.
(b) A production is added to the grammar where the left-hand side
is N and the right-hand side is the terminal for the
extension insertion point of the base type followed by the
non-terminal for the extension insertion point. This
production is an insertion point production.
(c) A production is added to the grammar where the left-hand side
is the non-terminal for the extension insertion point of the
base type and the right-hand side is the terminal for the
extension insertion point followed by the non-terminal for
the extension insertion point.
(d) A production is added to the grammar where the left-hand side
is the non-terminal for the extension insertion point of the
base type and the right-hand side is empty.
<span class="grey">Legg Experimental [Page 43]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(7) If the base type is subject to a MULTIFORM-INSERTIONS encoding
instruction, then:
(a) A production is added to the grammar where the left-hand side
is N and the right-hand side is the general extension
terminal followed by the non-terminal for the extension
insertion point of the base type. This production is an
insertion point production.
(b) A production is added to the grammar where the left-hand side
is the non-terminal for the extension insertion point of the
base type and the right-hand side is the general extension
terminal followed by the non-terminal for the extension
insertion point.
(c) A production is added to the grammar where the left-hand side
is the non-terminal for the extension insertion point of the
base type and the right-hand side is empty.
If an ExtensionAdditionAlternative is a NamedType, then a production
is added to the grammar where the left-hand side is the non-terminal
for the ExtensionAdditionAlternative and the right-hand side is the
primary non-terminal for the NamedType.
If an ExtensionAdditionAlternative is an
ExtensionAdditionAlternativesGroup, then a production is added to the
grammar for each NamedType nested in the
ExtensionAdditionAlternativesGroup, where the left-hand side is the
non-terminal for the ExtensionAdditionAlternative and the right-hand
side is the primary non-terminal for the NamedType.
<span class="grey">Legg Experimental [Page 44]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Example
Consider the following ASN.1 type definition:
CHOICE {
-- Start of RootAlternativeTypeList.
one BOOLEAN,
two INTEGER,
-- End of RootAlternativeTypeList.
...,
-- Start of ExtensionAdditionAlternatives.
three INTEGER, -- First ExtensionAdditionAlternative (E1).
[[ -- An ExtensionAdditionAlternativesGroup.
four UTF8String,
five INTEGER
]] -- Second ExtensionAdditionAlternative (E2).
-- The extension insertion point is here (I1).
}
Here is the grammar derived from this type:
S ::= one
S ::= two
S ::= E1
S ::= E2
S ::= I1
I1 ::= "*" I1
I1 ::=
E1 ::= three
E2 ::= four
E2 ::= five
one ::= "one"
two ::= "two"
three ::= "three"
four ::= "four"
five ::= "five"
If the CHOICE type were subject to a NO-INSERTIONS encoding
instruction, then the fifth, sixth, and seventh productions would
be removed.
If the CHOICE type were subject to a HOLLOW-INSERTIONS encoding
instruction, then the fifth, sixth, and seventh productions would
be replaced by:
<span class="grey">Legg Experimental [Page 45]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
S ::=
If the CHOICE type were subject to a SINGULAR-INSERTIONS encoding
instruction, then the fifth, sixth, and seventh productions would
be replaced by:
S ::= "*"
If the CHOICE type were subject to a UNIFORM-INSERTIONS encoding
instruction, then the fifth and sixth productions would be
replaced by:
S ::= "*"
S ::= "*1" I1
I1 ::= "*1" I1
If the CHOICE type were subject to a MULTIFORM-INSERTIONS encoding
instruction, then the fifth production would be replaced by:
S ::= "*" I1
Constraints on a SEQUENCE, SET, or CHOICE type are ignored. They do
not affect the grammar being generated.
Aside: This avoids an awkward situation where values of a subtype
have to be decoded differently from values of the parent type. It
also simplifies the verification procedure.
Given a primary non-terminal, N, and a type that has a SEQUENCE OF or
SET OF base type and that permits a value of size zero (i.e., an
empty sequence or set):
(1) a production is added to the grammar where the left-hand side of
the production is N and the right-hand side is the primary
non-terminal for the NamedType of the component of the
SEQUENCE OF or SET OF base type, followed by N, and
(2) a production is added to the grammar where the left-hand side of
the production is N and the right-hand side is empty.
Given a primary non-terminal, N, a secondary non-terminal, N', and a
type that has a SEQUENCE OF or SET OF base type and that does not
permit a value of size zero:
<span class="grey">Legg Experimental [Page 46]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(1) a production is added to the grammar where the left-hand side of
the production is N and the right-hand side is the primary
non-terminal for the NamedType of the component of the
SEQUENCE OF or SET OF base type, followed by N', and
(2) a production is added to the grammar where the left-hand side of
the production is N' and the right-hand side is the primary
non-terminal for the NamedType of the component of the
SEQUENCE OF or SET OF base type, followed by N', and
(3) a production is added to the grammar where the left-hand side of
the production is N' and the right-hand side is empty.
Example
Consider the following ASN.1 type definition:
SEQUENCE SIZE(1..MAX) OF number INTEGER
Here is the grammar derived from this type:
S ::= number S'
S' ::= number S'
S' ::=
number ::= "number"
All inner subtyping (InnerTypeContraints) is ignored for the purposes
of deciding whether a value of size zero is permitted by a
SEQUENCE OF or SET OF type.
This completes the description of the transformation of ASN.1
combining type definitions into a grammar.
<span class="h4"><a class="selflink" id="section-25.1.2" href="#section-25.1.2">25.1.2</a>. Unique Component Attribution</span>
This section describes conditions that the grammar must satisfy so
that each element and attribute in a received RXER encoding can be
uniquely associated with an ASN.1 component definition.
Definition (used by the grammar): A non-terminal, N, is used by the
grammar if:
(1) N is the start symbol or
(2) N appears on the right-hand side of a production where the
non-terminal on the left-hand side is used by the grammar.
<span class="grey">Legg Experimental [Page 47]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-48" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Definition (multiple derivation paths): A non-terminal, N, has
multiple derivation paths if:
(1) N appears on the right-hand side of a production where the
non-terminal on the left-hand side has multiple derivation paths,
or
(2) N appears on the right-hand side of more than one production
where the non-terminal on the left-hand side is used by the
grammar, or
(3) N is the start symbol and it appears on the right-hand side of a
production where the non-terminal on the left-hand side is used
by the grammar.
For every ASN.1 type with a base type containing components that are
subject to a GROUP encoding instruction, the grammar derived by the
method described in this document MUST NOT have:
(1) two or more primary non-terminals that are used by the grammar
and are associated with element components having the same
expanded name, or
(2) two or more primary non-terminals that are used by the grammar
and are associated with attribute components having the same
expanded name, or
(3) a primary non-terminal that has multiple derivation paths and is
associated with an attribute component.
Aside: Case (1) is in response to component referencing notations
that are evaluated with respect to the XML encoding of an abstract
value. Case (1) guarantees, without having to do extensive
testing (which would necessarily have to take account of encoding
instructions for all other encoding rules), that all sibling
elements with the same expanded name will be associated with
equivalent type definitions. Such equivalence allows a component
referenced by element name to be re-encoded using a different set
of ASN.1 encoding rules without ambiguity as to which type
definition and encoding instructions apply.
Cases (2) and (3) ensure that an attribute name is always uniquely
associated with one component that can occur at most once and is
always nested in the same part of an abstract value.
<span class="grey">Legg Experimental [Page 48]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-49" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Example
The following example types illustrate various uses and misuses of
the GROUP encoding instruction with respect to unique component
attribution:
TA ::= SEQUENCE {
a [GROUP] TB,
b [GROUP] CHOICE {
a [GROUP] TB,
b [NAME AS "c"] [ATTRIBUTE] INTEGER,
c INTEGER,
d TB,
e [GROUP] TD,
f [ATTRIBUTE] UTF8String
},
c [ATTRIBUTE] INTEGER,
d [GROUP] SEQUENCE OF
a [GROUP] SEQUENCE {
a [ATTRIBUTE] OBJECT IDENTIFIER,
b INTEGER
},
e [NAME AS "c"] INTEGER,
COMPONENTS OF TD
}
TB ::= SEQUENCE {
a INTEGER,
b [ATTRIBUTE] BOOLEAN,
COMPONENTS OF TC
}
TC ::= SEQUENCE {
f OBJECT IDENTIFIER
}
TD ::= SEQUENCE {
g OBJECT IDENTIFIER
}
The grammar for TA is constructed after performing the
COMPONENTS OF transformation. The result of this transformation
is shown next. This example will depart from the usual convention
of using just the identifier of a NamedType to represent the
primary non-terminal for that NamedType. A label relative to the
outermost type will be used instead to better illustrate unique
component attribution. The labels used for the non-terminals are
shown down the right-hand side.
<span class="grey">Legg Experimental [Page 49]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-50" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
TA ::= SEQUENCE {
a [GROUP] TB, -- TA.a
b [GROUP] CHOICE { -- TA.b
a [GROUP] TB, -- TA.b.a
b [NAME AS "c"] [ATTRIBUTE] INTEGER, -- TA.b.b
c INTEGER, -- TA.b.c
d TB, -- TA.b.d
e [GROUP] TD, -- TA.b.e
f [ATTRIBUTE] UTF8String -- TA.b.f
},
c [ATTRIBUTE] INTEGER, -- TA.c
d [GROUP] SEQUENCE OF -- TA.d
a [GROUP] SEQUENCE { -- TA.d.a
a [ATTRIBUTE] OBJECT IDENTIFIER, -- TA.d.a.a
b INTEGER -- TA.d.a.b
},
e [NAME AS "c"] INTEGER, -- TA.e
g OBJECT IDENTIFIER -- TA.g
}
TB ::= SEQUENCE {
a INTEGER, -- TB.a
b [ATTRIBUTE] BOOLEAN, -- TB.b
f OBJECT IDENTIFIER -- TB.f
}
-- Type TC is no longer of interest. --
TD ::= SEQUENCE {
g OBJECT IDENTIFIER -- TD.g
}
The associated grammar is:
S ::= TA.a TA.b TA.c TA.d TA.e TA.g
TA.a ::= TB.a TB.b TB.f
TB.a ::= "a"
TB.b ::= "@b"
TB.f ::= "f"
TA.b ::= TA.b.a
TA.b ::= TA.b.b
TA.b ::= TA.b.c
TA.b ::= TA.b.d
TA.b ::= TA.b.e
TA.b ::= TA.b.f
<span class="grey">Legg Experimental [Page 50]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-51" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
TA.b.a ::= TB.a TB.b TB.f
TA.b.b ::= "@c"
TA.b.c ::= "c"
TA.b.d ::= "d"
TA.b.e ::= TD.g
TA.b.f ::= "@f"
TD.g ::= "g"
TA.c ::= "@c"
TA.d ::= TA.d.a TA.d
TA.d ::=
TA.d.a ::= TA.d.a.a TA.d.a.b
TA.d.a.a := "@a"
TA.d.a.b ::= "b"
TA.e ::= "c"
TA.g ::= "g"
All the non-terminals are used by the grammar.
The type definition for TA is invalid because there are two
instances where two or more primary non-terminals are associated
with element components having the same expanded name:
(1) TA.b.c and TA.e (both generate the terminal "c"), and
(2) TD.g and TA.g (both generate the terminal "g").
In case (2), TD.g and TA.g are derived from the same instance of
NamedType notation, but become distinct components following the
COMPONENTS OF transformation. AUTOMATIC tagging is applied after
the COMPONENTS OF transformation, which means that the types of
the components corresponding to TD.g and TA.g will end up with
different tags, and therefore the types will not be equivalent.
The type definition for TA is also invalid because there is one
instance where two or more primary non-terminals are associated
with attribute components having the same expanded name: TA.b.b
and TA.c (both generate the terminal "@c").
<span class="grey">Legg Experimental [Page 51]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-52" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The non-terminals with multiple derivation paths are: TA.d,
TA.d.a, TA.d.a.a, TA.d.a.b, TB.a, TB.b, and TB.f. The type
definition for TA is also invalid because TA.d.a.a and TB.b are
primary non-terminals that are associated with an attribute
component.
<span class="h4"><a class="selflink" id="section-25.1.3" href="#section-25.1.3">25.1.3</a>. Deterministic Grammars</span>
Let the First Set of a production P, denoted First(P), be the set of
all element terminals T where T is the first element terminal in a
sequence of terminals that can be generated from the right-hand side
of P. There can be any number of leading attribute terminals before
T.
Let the Follow Set of a non-terminal N, denoted Follow(N), be the set
of all element terminals T where T is the first element terminal
following N in a sequence of non-terminals and terminals that can be
generated from the grammar. There can be any number of attribute
terminals between N and T. If a sequence of non-terminals and
terminals can be generated from the grammar where N is not followed
by any element terminals, then Follow(N) also contains a special end
terminal, denoted by "$".
Aside: If N does not appear on the right-hand side of any
production, then Follow(N) will be empty.
For a production P, let the predicate Empty(P) be true if and only if
the empty sequence of terminals can be generated from P. Otherwise,
Empty(P) is false.
Definition (base grammar): The base grammar is a rewriting of the
grammar in which the non-terminals for every ExtensionAddition and
ExtensionAdditionAlternative are removed from the right-hand side of
all productions.
For a production P, let the predicate Preselected(P) be true if and
only if every sequence of terminals that can be generated from the
right-hand side of P using only the base grammar contains at least
one attribute terminal. Otherwise, Preselected(P) is false.
The Select Set of a production P, denoted Select(P), is empty if
Preselected(P) is true; otherwise, it contains First(P). Let N be
the non-terminal on the left-hand side of P. If Empty(P) is true,
then Select(P) also contains Follow(N).
<span class="grey">Legg Experimental [Page 52]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-53" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Aside: It may appear somewhat dubious to include the attribute
components in the grammar because, in reality, attributes appear
unordered within the start tag of an element, and not interspersed
with the child elements as the grammar would suggest. This is why
attribute terminals are ignored in composing the First Sets and
Follow Sets. However, the attribute terminals are important in
composing the Select Sets because they can preselect a production
and can prevent a production from being able to generate an empty
sequence of terminals. In real terms, this corresponds to an RXER
decoder using the attributes to determine the presence or absence
of optional components and to select between the alternatives of a
CHOICE, even before considering the child elements.
An attribute appearing in an extension isn't used to preselect a
production since, in general, a decoder using an earlier version
of the specification would not be able to associate the attribute
with any particular extension insertion point.
Let the Reach Set of a non-terminal N, denoted Reach(N), be the set
of all element terminals T where T appears in a sequence of terminals
that can be generated from N.
Aside: It can be readily shown that all the optional attribute
components and all but one of the mandatory attribute components
of a SEQUENCE or SET type can be ignored in constructing the
grammar because their omission does not alter the First, Follow,
Select, or Reach Sets, or the evaluation of the Preselected and
Empty predicates.
A grammar is deterministic (for the purposes of an RXER decoder) if
and only if:
(1) there do not exist two productions P and Q, with the same
non-terminal on the left-hand side, where the intersection of
Select(P) and Select(Q) is not empty, and
(2) there does not exist a non-terminal E for an ExtensionAddition or
ExtensionAdditionAlternative where the intersection of Reach(E)
and Follow(E) is not empty.
Aside: In case (1), if the intersection is not empty, then a
decoder would have two or more possible ways to attempt to decode
the input into an abstract value. In case (2), if the
intersection is not empty, then a decoder using an earlier version
of the ASN.1 specification would confuse an element in an unknown
(to that decoder) extension with a known component following the
extension.
<span class="grey">Legg Experimental [Page 53]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-54" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Aside: In the absence of any attribute components, case (1) is the
test for an LL(1) grammar.
For every ASN.1 type with a base type containing components that are
subject to a GROUP encoding instruction, the grammar derived by the
method described in this document MUST be deterministic.
<span class="h4"><a class="selflink" id="section-25.1.4" href="#section-25.1.4">25.1.4</a>. Attributes in Unknown Extensions</span>
An insertion point production is able to accept unknown attributes if
the non-terminal on the left-hand side of the production does not
have multiple derivation paths.
Aside: If the non-terminal has multiple derivation paths, then any
future extension cannot possibly contain an attribute component
because that would violate the requirements of <a href="#section-25.1.2">Section 25.1.2</a>.
For a deterministic grammar, there is only one possible way to
construct a sequence of element terminals matching the element
content of an element in a correctly formed RXER encoding. Any
unknown attributes of the element are accepted if at least one
insertion point production that is able to accept unknown attributes
is used in that construction.
Example
Consider this type definition:
CHOICE {
one UTF8String,
two [GROUP] SEQUENCE {
three INTEGER,
...
}
}
The associated grammar is:
S ::= one
S ::= two
two ::= three I1
I1 ::= "*" I1
I1 ::=
one ::= "one"
three ::= "three"
<span class="grey">Legg Experimental [Page 54]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-55" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The third production is an insertion point production, and it is
able to accept unknown attributes.
When decoding a value of this type, if the element content
contains a <one> child element, then any unrecognized attribute
would be illegal as the insertion point production would not be
used to recognize the input (the "one" alternative does not admit
an extension insertion point). If the element content contains a
<three> element, then an unrecognized attribute would be accepted
because the insertion point production would be used to recognize
the input (the "two" alternative that generates the <three>
element has an extensible type).
If the SEQUENCE type were prefixed by a NO-INSERTIONS encoding
instruction, then the third, fourth, and fifth productions would
be replaced by:
two ::= three
With this change, any unrecognized attribute would be illegal for
the "two" alternative also, since the replacement production is
not an insertion point production.
If more than one insertion point production that is able to accept
unknown attributes is used in constructing a matching sequence of
element terminals, then a decoder is free to associate an
unrecognized attribute with any one of the extension insertion points
corresponding to those insertion point productions. The
justification for doing so comes from the following two observations:
(1) If the encoding of an abstract value contains an extension where
the type of the extension is unknown to the receiver, then it is
generally impossible to re-encode the value using a different set
of encoding rules, including the canonical variant of the
received encoding. This is true no matter which encoding rules
are being used. It is desirable for a decoder to be able to
accept and store the raw encoding of an extension without raising
an error, and to re-insert the raw encoding of the extension when
re-encoding the abstract value using the same non-canonical
encoding rules. However, there is little more that an
application can do with an unknown extension.
An application using RXER can successfully accept, store, and
re-encode an unrecognized attribute regardless of which extension
insertion point it might be ascribed to.
<span class="grey">Legg Experimental [Page 55]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-56" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
(2) Even if there is a single extension insertion point, an unknown
extension could still be the encoding of a value of any one of an
infinite number of valid type definitions. For example, an
attribute or element component could be nested to any arbitrary
depth within CHOICEs whose components are subject to GROUP
encoding instructions.
Aside: A similar series of nested CHOICEs could describe an
unknown extension in a Basic Encoding Rules (BER) encoding
[<a href="#ref-X.690" title=" Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER)">X.690</a>].
<span class="h2"><a class="selflink" id="section-26" href="#section-26">26</a>. Security Considerations</span>
ASN.1 compiler implementors should take special care to be thorough
in checking that the GROUP encoding instruction has been correctly
used; otherwise, ASN.1 specifications with ambiguous RXER encodings
could be deployed.
Ambiguous encodings mean that the abstract value recovered by a
decoder may differ from the original abstract value that was encoded.
If that is the case, then a digital signature generated with respect
to the original abstract value (using a canonical encoding other than
CRXER) will not be successfully verified by a receiver using the
decoded abstract value. Also, an abstract value may have
security-sensitive fields, and in particular, fields used to grant or
deny access. If the decoded abstract value differs from the encoded
abstract value, then a receiver using the decoded abstract value will
be applying different security policy than that embodied in the
original abstract value.
<span class="h2"><a class="selflink" id="section-27" href="#section-27">27</a>. References</span>
<span class="h3"><a class="selflink" id="section-27.1" href="#section-27.1">27.1</a>. Normative References</span>
[<a id="ref-BCP14">BCP14</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
[<a id="ref-URI">URI</a>] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform
Resource Identifiers (URI): Generic Syntax", STD 66, <a href="./rfc3986">RFC</a>
<a href="./rfc3986">3986</a>, January 2005.
[<a id="ref-RXER">RXER</a>] Legg, S. and D. Prager, "Robust XML Encoding Rules (RXER)
for Abstract Syntax Notation One (ASN.1)", <a href="./rfc4910">RFC 4910</a>, July
2007.
[<a id="ref-ASN.X">ASN.X</a>] Legg, S., "Abstract Syntax Notation X (ASN.X)", <a href="./rfc4912">RFC 4912</a>,
July 2007.
<span class="grey">Legg Experimental [Page 56]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-57" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
[<a id="ref-X.680">X.680</a>] ITU-T Recommendation X.680 (07/02) | ISO/IEC 8824-1,
Information technology - Abstract Syntax Notation One
(ASN.1): Specification of basic notation.
[<a id="ref-X.680-1">X.680-1</a>] ITU-T Recommendation X.680 (2002) Amendment 1 (10/03) |
ISO/IEC 8824-1:2002/Amd 1:2004, Support for EXTENDED-XER.
[<a id="ref-X.683">X.683</a>] ITU-T Recommendation X.683 (07/02) | ISO/IEC 8824-4,
Information technology - Abstract Syntax Notation One
(ASN.1): Parameterization of ASN.1 specifications.
[<a id="ref-XML10">XML10</a>] Bray, T., Paoli, J., Sperberg-McQueen, C., Maler, E. and
F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fourth
Edition)", W3C Recommendation,
<a href="http://www.w3.org/TR/2006/REC-xml-20060816">http://www.w3.org/TR/2006/REC-xml-20060816</a>, August 2006.
[<a id="ref-XMLNS10">XMLNS10</a>] Bray, T., Hollander, D., Layman, A., and R. Tobin,
"Namespaces in XML 1.0 (Second Edition)", W3C
Recommendation,
<a href="http://www.w3.org/TR/2006/REC-xml-names-20060816">http://www.w3.org/TR/2006/REC-xml-names-20060816</a>, August
2006.
[<a id="ref-XSD1">XSD1</a>] Thompson, H., Beech, D., Maloney, M. and N. Mendelsohn,
"XML Schema Part 1: Structures Second Edition", W3C
Recommendation,
<a href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/">http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/</a>,
October 2004.
[<a id="ref-XSD2">XSD2</a>] Biron, P. and A. Malhotra, "XML Schema Part 2: Datatypes
Second Edition", W3C Recommendation,
<a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/">http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/</a>,
October 2004.
[<a id="ref-RNG">RNG</a>] Clark, J. and M. Makoto, "RELAX NG Tutorial", OASIS
Committee Specification, <a href="http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html">http://www.oasis-open.org/</a>
<a href="http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html">committees/relax-ng/tutorial-20011203.html</a>, December 2001.
<span class="h3"><a class="selflink" id="section-27.2" href="#section-27.2">27.2</a>. Informative References</span>
[<a id="ref-INFOSET">INFOSET</a>] Cowan, J. and R. Tobin, "XML Information Set (Second
Edition)", W3C Recommendation, <a href="http://www.w3.org/TR/2004/REC-xml-infoset-20040204">http://www.w3.org/</a>
<a href="http://www.w3.org/TR/2004/REC-xml-infoset-20040204">TR/2004/REC-xml-infoset-20040204</a>, February 2004.
[<a id="ref-X.690">X.690</a>] ITU-T Recommendation X.690 (07/02) | ISO/IEC 8825-1,
Information technology - ASN.1 encoding rules:
Specification of Basic Encoding Rules (BER), Canonical
Encoding Rules (CER) and Distinguished Encoding Rules
(DER).
<span class="grey">Legg Experimental [Page 57]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-58" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. GROUP Encoding Instruction Examples</span>
This appendix is non-normative.
This appendix contains examples of both correct and incorrect use of
the GROUP encoding instruction, determined with respect to the
grammars derived from the example type definitions. The productions
of the grammars are labeled for convenience. Sets and predicates for
non-terminals with only one production will be omitted from the
examples since they never indicate non-determinism.
The requirements of <a href="#section-25.1.2">Section 25.1.2</a> ("Unique Component Attribution")
are satisfied by all the examples in this appendix and the appendices
that follow it.
<span class="h3"><a class="selflink" id="appendix-A.1" href="#appendix-A.1">A.1</a>. Example 1</span>
Consider this type definition:
SEQUENCE {
one [GROUP] SEQUENCE {
two UTF8String OPTIONAL
} OPTIONAL,
three INTEGER
}
The associated grammar is:
P1: S ::= one three
P2: one ::= two
P3: one ::=
P4: two ::= "two"
P5: two ::=
P6: three ::= "three"
Select Sets have to be evaluated to test the validity of the type
definition. The grammar leads to the following sets and predicates:
First(P2) = { "two" }
First(P3) = { }
Preselected(P2) = Preselected(P3) = false
Empty(P2) = Empty(P3) = true
Follow(one) = { "three" }
Select(P2) = First(P2) + Follow(one) = { "two", "three" }
Select(P3) = First(P3) + Follow(one) = { "three" }
<span class="grey">Legg Experimental [Page 58]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-59" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
First(P4) = { "two" }
First(P5) = { }
Preselected(P4) = Preselected(P5) = Empty(P4) = false
Empty(P5) = true
Follow(two) = { "three" }
Select(P4) = First(P4) = { "two" }
Select(P5) = First(P5) + Follow(two) = { "three" }
The intersection of Select(P2) and Select(P3) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. If the RXER encoding of a value of the type does not have a
child element <two>, then it is not possible to determine whether the
"one" component is present or absent in the value.
Now consider this type definition with attributes in the "one"
component:
SEQUENCE {
one [GROUP] SEQUENCE {
two UTF8String OPTIONAL,
four [ATTRIBUTE] BOOLEAN,
five [ATTRIBUTE] BOOLEAN OPTIONAL
} OPTIONAL,
three INTEGER
}
The associated grammar is:
P1: S ::= one three
P2: one ::= two four five
P3: one ::=
P4: two ::= "two"
P5: two ::=
P6: four ::= "@four"
P7: five ::= "@five"
P8: five ::=
P9: three ::= "three"
This grammar leads to the following sets and predicates:
First(P2) = { "two" }
First(P3) = { }
Preselected(P3) = Empty(P2) = false
Preselected(P2) = Empty(P3) = true
Follow(one) = { "three" }
Select(P2) = { }
Select(P3) = First(P3) + Follow(one) = { "three" }
<span class="grey">Legg Experimental [Page 59]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-60" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
First(P4) = { "two" }
First(P5) = { }
Preselected(P4) = Preselected(P5) = Empty(P4) = false
Empty(P5) = true
Follow(two) = { "three" }
Select(P4) = First(P4) = { "two" }
Select(P5) = First(P5) + Follow(two) = { "three" }
First(P7) = { }
First(P8) = { }
Preselected(P8) = Empty(P7) = false
Preselected(P7) = Empty(P8) = true
Follow(five) = { "three" }
Select(P7) = { }
Select(P8) = First(P8) + Follow(five) = { "three" }
The intersection of Select(P2) and Select(P3) is empty, as is the
intersection of Select(P4) and Select(P5) and the intersection of
Select(P7) and Select(P8); hence, the grammar is deterministic, and
the type definition is valid. In a correct RXER encoding, the "one"
component will be present if and only if the "four" attribute is
present.
<span class="h3"><a class="selflink" id="appendix-A.2" href="#appendix-A.2">A.2</a>. Example 2</span>
Consider this type definition:
CHOICE {
one [GROUP] SEQUENCE {
two [ATTRIBUTE] BOOLEAN OPTIONAL
},
three INTEGER,
four [GROUP] SEQUENCE {
five BOOLEAN OPTIONAL
}
}
The associated grammar is:
P1: S ::= one
P2: S ::= three
P3: S ::= four
P4: one ::= two
P5: two ::= "@two"
P6: two ::=
P7: three ::= "three"
P8: four ::= five
P9: five ::= "five"
<span class="grey">Legg Experimental [Page 60]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-61" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
P10: five ::=
This grammar leads to the following sets and predicates:
First(P1) = { }
First(P2) = { "three" }
First(P3) = { "five" }
Preselected(P1) = Preselected(P2) = Preselected(P3) = false
Empty(P2) = false
Empty(P1) = Empty(P3) = true
Follow(S) = { "$" }
Select(P1) = First(P1) + Follow(S) = { "$" }
Select(P2) = First(P2) = { "three" }
Select(P3) = First(P3) + Follow(S) = { "five", "$" }
First(P5) = { }
First(P6) = { }
Preselected(P6) = Empty(P5) = false
Preselected(P5) = Empty(P6) = true
Follow(two) = { "$" }
Select(P5) = { }
Select(P6) = First(P6) + Follow(two) = { "$" }
First(P9) = { "five" }
First(P10) = { }
Preselected(P9) = Preselected(P10) = Empty(P9) = false
Empty(P10) = true
Follow(five) = { "$" }
Select(P9) = First(P9) = { "five" }
Select(P10) = First(P10) + Follow(five) = { "$" }
The intersection of Select(P1) and Select(P3) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. If the RXER encoding of a value of the type is empty, then it
is not possible to determine whether the "one" alternative or the
"four" alternative has been chosen.
Now consider this slightly different type definition:
CHOICE {
one [GROUP] SEQUENCE {
two [ATTRIBUTE] BOOLEAN
},
three INTEGER,
four [GROUP] SEQUENCE {
five BOOLEAN OPTIONAL
}
}
<span class="grey">Legg Experimental [Page 61]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-62" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The associated grammar is:
P1: S ::= one
P2: S ::= three
P3: S ::= four
P4: one ::= two
P5: two ::= "@two"
P6: three ::= "three"
P7: four ::= five
P8: five ::= "five"
P9: five ::=
This grammar leads to the following sets and predicates:
First(P1) = { }
First(P2) = { "three" }
First(P3) = { "five" }
Preselected(P2) = Preselected(P3) = false
Empty(P1) = Empty(P2) = false
Preselected(P1) = Empty(P3) = true
Follow(S) = { "$" }
Select(P1) = { }
Select(P2) = First(P2) = { "three" }
Select(P3) = First(P3) + Follow(S) = { "five", "$" }
First(P8) = { "five" }
First(P9) = { }
Preselected(P8) = Preselected(P9) = Empty(P8) = false
Empty(P9) = true
Follow(five) = { "$" }
Select(P8) = First(P8) = { "five" }
Select(P9) = First(P9) + Follow(five) = { "$" }
The intersection of Select(P1) and Select(P2) is empty, the
intersection of Select(P1) and Select(P3) is empty, the intersection
of Select(P2) and Select(P3) is empty, and the intersection of
Select(P8) and Select(P9) is empty; hence, the grammar is
deterministic, and the type definition is valid. The "one" and
"four" alternatives can be distinguished because the "one"
alternative has a mandatory attribute.
<span class="grey">Legg Experimental [Page 62]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-63" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h3"><a class="selflink" id="appendix-A.3" href="#appendix-A.3">A.3</a>. Example 3</span>
Consider this type definition:
SEQUENCE {
one [GROUP] CHOICE {
two [ATTRIBUTE] BOOLEAN,
three [GROUP] SEQUENCE OF number INTEGER
} OPTIONAL
}
The associated grammar is:
P1: S ::= one
P2: one ::= two
P3: one ::= three
P4: one ::=
P5: two ::= "@two"
P6: three ::= number three
P7: three ::=
P8: number ::= "number"
This grammar leads to the following sets and predicates:
First(P2) = { }
First(P3) = { "number" }
First(P4) = { }
Preselected(P3) = Preselected(P4) = Empty(P2) = false
Preselected(P2) = Empty(P3) = Empty(P4) = true
Follow(one) = { "$" }
Select(P2) = { }
Select(P3) = First(P3) + Follow(one) = { "number", "$" }
Select(P4) = First(P4) + Follow(one) = { "$" }
First(P6) = { "number" }
First(P7) = { }
Preselected(P6) = Preselected(P7) = Empty(P6) = false
Empty(P7) = true
Follow(three) = { "$" }
Select(P6) = First(P6) = { "number" }
Select(P7) = First(P7) + Follow(three) = { "$" }
The intersection of Select(P3) and Select(P4) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. If the RXER encoding of a value of the type is empty, then it
is not possible to determine whether the "one" component is absent or
the empty "three" alternative has been chosen.
<span class="grey">Legg Experimental [Page 63]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-64" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h3"><a class="selflink" id="appendix-A.4" href="#appendix-A.4">A.4</a>. Example 4</span>
Consider this type definition:
SEQUENCE {
one [GROUP] CHOICE {
two [ATTRIBUTE] BOOLEAN,
three [ATTRIBUTE] BOOLEAN
} OPTIONAL
}
The associated grammar is:
P1: S ::= one
P2: one ::= two
P3: one ::= three
P4: one ::=
P5: two ::= "@two"
P6: three ::= "@three"
This grammar leads to the following sets and predicates:
First(P2) = { }
First(P3) = { }
First(P4) = { }
Preselected(P4) = Empty(P2) = Empty(P3) = false
Preselected(P2) = Preselected(P3) = Empty(P4) = true
Follow(one) = { "$" }
Select(P2) = { }
Select(P3) = { }
Select(P4) = First(P4) + Follow(one) = { "$" }
The intersection of Select(P2) and Select(P3) is empty, the
intersection of Select(P2) and Select(P4) is empty, and the
intersection of Select(P3) and Select(P4) is empty; hence, the
grammar is deterministic, and the type definition is valid.
<span class="h3"><a class="selflink" id="appendix-A.5" href="#appendix-A.5">A.5</a>. Example 5</span>
Consider this type definition:
SEQUENCE {
one [GROUP] SEQUENCE OF number INTEGER OPTIONAL
}
<span class="grey">Legg Experimental [Page 64]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-65" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The associated grammar is:
P1: S ::= one
P2: one ::= number one
P3: one ::=
P4: one ::=
P5: number ::= "number"
P3 is generated during the processing of the SEQUENCE OF type. P4 is
generated because the "one" component is optional.
This grammar leads to the following sets and predicates:
First(P2) = { "number" }
First(P3) = { }
First(P4) = { }
Preselected(P2) = Preselected(P3) = Preselected(P4) = false
Empty(P2) = false
Empty(P3) = Empty(P4) = true
Follow(one) = { "$" }
Select(P2) = First(P2) = { "number" }
Select(P3) = First(P3) + Follow(one) = { "$" }
Select(P4) = First(P4) + Follow(one) = { "$" }
The intersection of Select(P3) and Select(P4) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. If the RXER encoding of a value of the type does not have any
<number> child elements, then it is not possible to determine whether
the "one" component is present or absent in the value.
Consider this similar type definition with a SIZE constraint:
SEQUENCE {
one [GROUP] SEQUENCE SIZE(1..MAX) OF number INTEGER OPTIONAL
}
The associated grammar is:
P1: S ::= one
P2: one ::= number one'
P3: one' ::= number one'
P4: one' ::=
P5: one ::=
P6: number ::= "number"
<span class="grey">Legg Experimental [Page 65]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-66" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
This grammar leads to the following sets and predicates:
First(P2) = { "number" }
First(P5) = { }
Preselected(P2) = Preselected(P5) = Empty(P2) = false
Empty(P5) = true
Follow(one) = { "$" }
Select(P2) = First(P2) = { "number" }
Select(P5) = First(P5) + Follow(one) = { "$" }
First(P3) = { "number" }
First(P4) = { }
Preselected(P3) = Preselected(P4) = Empty(P3) = false
Empty(P4) = true
Follow(one') = { "$" }
Select(P3) = First(P3) = { "number" }
Select(P4) = First(P4) + Follow(one') = { "$" }
The intersection of Select(P2) and Select(P5) is empty, as is the
intersection of Select(P3) and Select(P4); hence, the grammar is
deterministic, and the type definition is valid. If there are no
<number> child elements, then the "one" component is necessarily
absent and there is no ambiguity.
<span class="h3"><a class="selflink" id="appendix-A.6" href="#appendix-A.6">A.6</a>. Example 6</span>
Consider this type definition:
SEQUENCE {
beginning [GROUP] List,
middle UTF8String OPTIONAL,
end [GROUP] List
}
List ::= SEQUENCE OF string UTF8String
The associated grammar is:
P1: S ::= beginning middle end
P2: beginning ::= string beginning
P3: beginning ::=
P4: middle ::= "middle"
P5: middle ::=
P6: end ::= string end
P7: end ::=
P8: string ::= "string"
<span class="grey">Legg Experimental [Page 66]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-67" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
This grammar leads to the following sets and predicates:
First(P2) = { "string" }
First(P3) = { }
Preselected(P2) = Preselected(P3) = Empty(P2) = false
Empty(P3) = true
Follow(beginning) = { "middle", "string", "$" }
Select(P2) = First(P2) = { "string" }
Select(P3) = First(P3) + Follow(beginning)
= { "middle", "string", "$" }
First(P4) = { "middle" }
First(P5) = { }
Preselected(P4) = Preselected(P5) = Empty(P4) = false
Empty(P5) = true
Follow(middle) = { "string", "$" }
Select(P4) = First(P4) = { "middle" }
Select(P5) = First(P5) + Follow(middle) = { "string", "$" }
First(P6) = { "string" }
First(P7) = { }
Preselected(P6) = Preselected(P7) = Empty(P6) = false
Empty(P7) = true
Follow(end) = { "$" }
Select(P6) = First(P6) = { "string" }
Select(P7) = First(P7) + Follow(end) = { "$" }
The intersection of Select(P2) and Select(P3) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid.
Now consider the following type definition:
SEQUENCE {
beginning [GROUP] List,
middleAndEnd [GROUP] SEQUENCE {
middle UTF8String,
end [GROUP] List
} OPTIONAL
}
The associated grammar is:
P1: S ::= beginning middleAndEnd
P2: beginning ::= string beginning
P3: beginning ::=
P4: middleAndEnd ::= middle end
P5: middleAndEnd ::=
<span class="grey">Legg Experimental [Page 67]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-68" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
P6: middle ::= "middle"
P7: end ::= string end
P8: end ::=
P9: string ::= "string"
This grammar leads to the following sets and predicates:
First(P2) = { "string" }
First(P3) = { }
Preselected(P2) = Preselected(P3) = Empty(P2) = false
Empty(P3) = true
Follow(beginning) = { "middle", "$" }
Select(P2) = First(P2) = { "string" }
Select(P3) = First(P3) + Follow(beginning) = { "middle", "$" }
First(P4) = { "middle" }
First(P5) = { }
Preselected(P4) = Preselected(P5) = Empty(P4) = false
Empty(P5) = true
Follow(middleAndEnd) = { "$" }
Select(P4) = First(P4) = { "middle" }
Select(P5) = First(P5) + Follow(middleAndEnd) = { "$" }
First(P7) = { "string" }
First(P8) = { }
Preselected(P7) = Preselected(P8) = Empty(P7) = false
Empty(P8) = true
Follow(end) = { "$" }
Select(P7) = First(P7) = { "string" }
Select(P8) = First(P8) + Follow(end) = { "$" }
The intersection of Select(P2) and Select(P3) is empty, as is the
intersection of Select(P4) and Select(P5) and the intersection of
Select(P7) and Select(P8); hence, the grammar is deterministic, and
the type definition is valid.
<span class="h3"><a class="selflink" id="appendix-A.7" href="#appendix-A.7">A.7</a>. Example 7</span>
Consider the following type definition:
SEQUENCE SIZE(1..MAX) OF
one [GROUP] SEQUENCE {
two INTEGER OPTIONAL
}
<span class="grey">Legg Experimental [Page 68]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-69" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The associated grammar is:
P1: S ::= one S'
P2: S' ::= one S'
P3: S' ::=
P4: one ::= two
P5: two ::= "two"
P6: two ::=
This grammar leads to the following sets and predicates:
First(P2) = { "two" }
First(P3) = { }
Preselected(P2) = Preselected(P3) = false
Empty(P2) = Empty(P3) = true
Follow(S') = { "$" }
Select(P2) = First(P2) + Follow(S') = { "two", "$" }
Select(P3) = First(P3) + Follow(S') = { "$" }
First(P5) = { "two" }
First(P6) = { }
Preselected(P5) = Preselected(P6) = Empty(P5) = false
Empty(P6) = true
Follow(two) = { "two", "$" }
Select(P5) = First(P5) = { "two" }
Select(P6) = First(P6) + Follow(two) = { "two", "$" }
The intersection of Select(P2) and Select(P3) is not empty and the
intersection of Select(P5) and Select(P6) is not empty; hence, the
grammar is not deterministic, and the type definition is not valid.
The encoding of a value of the type contains an indeterminate number
of empty instances of the component type.
<span class="h3"><a class="selflink" id="appendix-A.8" href="#appendix-A.8">A.8</a>. Example 8</span>
Consider the following type definition:
SEQUENCE OF
list [GROUP] SEQUENCE SIZE(1..MAX) OF number INTEGER
The associated grammar is:
P1: S ::= list S
P2: S ::=
P3: list ::= number list'
P4: list' ::= number list'
P5: list' ::=
P6: number ::= "number"
<span class="grey">Legg Experimental [Page 69]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-70" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
This grammar leads to the following sets and predicates:
First(P1) = { "number" }
First(P2) = { }
Preselected(P1) = Preselected(P2) = Empty(P1) = false
Empty(P2) = true
Follow(S) = { "$" }
Select(P1) = First(P1) = { "number" }
Select(P2) = First(P2) + Follow(S) = { "$" }
First(P4) = { "number" }
First(P5) = { }
Preselected(P4) = Preselected(P5) = Empty(P4) = false
Empty(P5) = true
Follow(list') = { "number", "$" }
Select(P4) = First(P4) = { "number" }
Select(P5) = First(P5) + Follow(list') = { "number", "$" }
The intersection of Select(P4) and Select(P5) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. The type describes a list of lists, but it is not possible
for a decoder to determine where the outer lists begin and end.
<span class="h3"><a class="selflink" id="appendix-A.9" href="#appendix-A.9">A.9</a>. Example 9</span>
Consider the following type definition:
SEQUENCE OF item [GROUP] SEQUENCE {
before [GROUP] OneAndTwo,
core UTF8String,
after [GROUP] OneAndTwo OPTIONAL
}
OneAndTwo ::= SEQUENCE {
non-core UTF8String
}
The associated grammar is:
P1: S ::= item S
P2: S ::=
P3: item ::= before core after
P4: before ::= non-core
P5: non-core ::= "non-core"
P6: core ::= "core"
P7: after ::= non-core
P8: after ::=
<span class="grey">Legg Experimental [Page 70]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-71" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
This grammar leads to the following sets and predicates:
First(P1) = { "non-core" }
First(P2) = { }
Preselected(P1) = Preselected(P2) = Empty(P1) = false
Empty(P2) = true
Follow(S) = { "$" }
Select(P1) = First(P1) = { "non-core" }
Select(P2) = First(P2) + Follow(S) = { "$" }
First(P7) = { "non-core" }
First(P8) = { }
Preselected(P7) = Preselected(P8) = Empty(P7) = false
Empty(P8) = true
Follow(after) = { "non-core", "$" }
Select(P7) = First(P7) = { "non-core" }
Select(P8) = First(P8) + Follow(after) = { "non-core", "$" }
The intersection of Select(P7) and Select(P8) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. There is ambiguity between the end of one item and the start
of the next. Without looking ahead in an encoding, it is not
possible to determine whether a <non-core> element belongs with the
preceding or following <core> element.
<span class="h3"><a class="selflink" id="appendix-A.10" href="#appendix-A.10">A.10</a>. Example 10</span>
Consider the following type definition:
CHOICE {
one [GROUP] List,
two [GROUP] SEQUENCE {
three [ATTRIBUTE] UTF8String,
four [GROUP] List
}
}
List ::= SEQUENCE OF string UTF8String
The associated grammar is:
P1: S ::= one
P2: S ::= two
P3: one ::= string one
P4: one ::=
P5: two ::= three four
P6: three ::= "@three"
P7: four ::= string four
<span class="grey">Legg Experimental [Page 71]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-72" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
P8: four ::=
P9: string ::= "string"
This grammar leads to the following sets and predicates:
First(P1) = { "string" }
First(P2) = { "string" }
Preselected(P1) = Empty(P2) = false
Preselected(P2) = Empty(P1) = true
Follow(S) = { "$" }
Select(P1) = First(P1) + Follow(S) = { "string", "$" }
Select(P2) = { }
First(P3) = { "string" }
First(P4) = { }
Preselected(P3) = Preselected(P4) = Empty(P3) = false
Empty(P4) = true
Follow(one) = { "$" }
Select(P3) = First(P3) = { "string" }
Select(P4) = First(P4) + Follow(one) = { "$" }
First(P7) = { "string" }
First(P8) = { }
Preselected(P7) = Preselected(P8) = Empty(P7) = false
Empty(P8) = true
Follow(four) = { "$" }
Select(P7) = First(P7) = { "string" }
Select(P8) = First(P8) + Follow(four) = { "$" }
The intersection of Select(P1) and Select(P2) is empty, as is the
intersection of Select(P3) and Select(P4) and the intersection of
Select(P7) and Select(P8); hence, the grammar is deterministic, and
the type definition is valid. Although both alternatives of the
CHOICE can begin with a <string> element, an RXER decoder would use
the presence of a "three" attribute to decide whether to select or
disregard the "two" alternative.
However, an attribute in an extension cannot be used to select
between alternatives. Consider the following type definition:
<span class="grey">Legg Experimental [Page 72]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-73" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
[<a id="ref-SINGULAR-INSERTIONS">SINGULAR-INSERTIONS</a>] CHOICE {
one [GROUP] List,
...,
two [GROUP] SEQUENCE {
three [ATTRIBUTE] UTF8String,
four [GROUP] List
} -- ExtensionAdditionAlternative (E1).
-- The extension insertion point is here (I1).
}
List ::= SEQUENCE OF string UTF8String
The associated grammar is:
P1: S ::= one
P10: S ::= E1
P11: S ::= "*"
P12: E1 ::= two
P3: one ::= string one
P4: one ::=
P5: two ::= three four
P6: three ::= "@three"
P7: four ::= string four
P8: four ::=
P9: string ::= "string"
This grammar leads to the following sets and predicates for P1, P10
and P11:
First(P1) = { "string" }
First(P10) = { "string" }
First(P11) = { "*" }
Preselected(P1) = Preselected(P10) = Preselected(P11) = false
Empty(P10) = Empty(P11) = false
Empty(P1) = true
Follow(S) = { "$" }
Select(P1) = First(P1) + Follow(S) = { "string", "$" }
Select(P10) = First(P10) = { "string" }
Select(P11) = First(P11) = { "*" }
Preselected(P10) evaluates to false because Preselected(P10) is
evaluated on the base grammar, wherein P10 is rewritten as:
P10: S ::=
<span class="grey">Legg Experimental [Page 73]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-74" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The intersection of Select(P1) and Select(P10) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. An RXER decoder using the original, unextended version of the
definition would not know that the "three" attribute selects between
the "one" alternative and the extension.
<span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Insertion Encoding Instruction Examples</span>
This appendix is non-normative.
This appendix contains examples showing the use of insertion encoding
instructions to remove extension ambiguity arising from use of the
GROUP encoding instruction.
<span class="h3"><a class="selflink" id="appendix-B.1" href="#appendix-B.1">B.1</a>. Example 1</span>
Consider the following type definition:
SEQUENCE {
one [GROUP] SEQUENCE {
two UTF8String,
... -- Extension insertion point (I1).
},
three INTEGER OPTIONAL,
... -- Extension insertion point (I2).
}
The associated grammar is:
P1: S ::= one three I2
P2: one ::= two I1
P3: two ::= "two"
P4: I1 ::= "*" I1
P5: I1 ::=
P6: three ::= "three"
P7: three ::=
P8: I2 ::= "*" I2
P9: I2 ::=
This grammar leads to the following sets and predicates:
First(P4) = { "*" }
First(P5) = { }
Preselected(P4) = Preselected(P5) = Empty(P4) = false
Empty(P5) = true
Follow(I1) = { "three", "*", "$" }
Select(P4) = First(P4) = { "*" }
Select(P5) = First(P5) + Follow(I1) = { "three", "*", "$" }
<span class="grey">Legg Experimental [Page 74]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-75" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
First(P6) = { "three" }
First(P7) = { }
Preselected(P6) = Preselected(P7) = Empty(P6) = false
Empty(P7) = true
Follow(three) = { "*", "$" }
Select(P6) = First(P6) = { "three" }
Select(P7) = First(P7) + Follow(three) = { "*", "$" }
First(P8) = { "*" }
First(P9) = { }
Preselected(P8) = Preselected(P9) = Empty(P8) = false
Empty(P9) = true
Follow(I2) = { "$" }
Select(P8) = First(P8) = { "*" }
Select(P9) = First(P9) + Follow(I2) = { "$" }
The intersection of Select(P4) and Select(P5) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. If an RXER decoder encounters an unrecognized element
immediately after a <two> element, then it will not know whether to
associate it with extension insertion point I1 or I2.
The non-determinism can be resolved with either a NO-INSERTIONS or
HOLLOW-INSERTIONS encoding instruction. Consider this revised type
definition:
SEQUENCE {
one [GROUP] [<a href="#ref-HOLLOW-INSERTIONS" title=" two [ATTRIBUTE] INTEGER">HOLLOW-INSERTIONS</a>] SEQUENCE {
two UTF8String,
... -- Extension insertion point (I1).
},
three INTEGER OPTIONAL,
... -- Extension insertion point (I2).
}
The associated grammar is:
P1: S ::= one three I2
P10: one ::= two
P3: two ::= "two"
P6: three ::= "three"
P7: three ::=
P8: I2 ::= "*" I2
P9: I2 ::=
With the addition of the HOLLOW-INSERTIONS encoding instruction, the
P4 and P5 productions are no longer generated, and the conflict
between Select(P4) and Select(P5) no longer exists. The Select Sets
<span class="grey">Legg Experimental [Page 75]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-76" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
for P6, P7, P8, and P9 are unchanged. A decoder will now assume that
an unrecognized element is to be associated with extension insertion
point I2. It is still free to associate an unrecognized attribute
with either extension insertion point. If a NO-INSERTIONS encoding
instruction had been used, then an unrecognized attribute could only
be associated with extension insertion point I2.
The non-determinism could also be resolved by adding a NO-INSERTIONS
or HOLLOW-INSERTIONS encoding instruction to the outer SEQUENCE:
[<a id="ref-HOLLOW-INSERTIONS">HOLLOW-INSERTIONS</a>] SEQUENCE {
one [GROUP] SEQUENCE {
two UTF8String,
... -- Extension insertion point (I1).
},
three INTEGER OPTIONAL,
... -- Extension insertion point (I2).
}
The associated grammar is:
P11: S ::= one three
P2: one ::= two I1
P3: two ::= "two"
P4: I1 ::= "*" I1
P5: I1 ::=
P6: three ::= "three"
P7: three ::=
This grammar leads to the following sets and predicates:
First(P4) = { "*" }
First(P5) = { }
Preselected(P4) = Preselected(P5) = Empty(P4) = false
Empty(P5) = true
Follow(I1) = { "three", "$" }
Select(P4) = First(P4) = { "*" }
Select(P5) = First(P5) + Follow(I1) = { "three", "$" }
First(P6) = { "three" }
First(P7) = { }
Preselected(P6) = Preselected(P7) = Empty(P6) = false
Empty(P7) = true
Follow(three) = { "$" }
Select(P6) = First(P6) = { "three" }
Select(P7) = First(P7) + Follow(three) = { "$" }
<span class="grey">Legg Experimental [Page 76]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-77" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The intersection of Select(P4) and Select(P5) is empty, as is the
intersection of Select(P6) and Select(P7); hence, the grammar is
deterministic, and the type definition is valid. A decoder will now
assume that an unrecognized element is to be associated with
extension insertion point I1. It is still free to associate an
unrecognized attribute with either extension insertion point. If a
NO-INSERTIONS encoding instruction had been used, then an
unrecognized attribute could only be associated with extension
insertion point I1.
<span class="h3"><a class="selflink" id="appendix-B.2" href="#appendix-B.2">B.2</a>. Example 2</span>
Consider the following type definition:
SEQUENCE {
one [GROUP] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
} OPTIONAL
}
The associated grammar is:
P1: S ::= one
P2: one ::= two
P3: one ::= I1
P4: one ::=
P5: two ::= "two"
P6: I1 ::= "*" I1
P7: I1 ::=
This grammar leads to the following sets and predicates:
First(P2) = { "two" }
First(P3) = { "*" }
First(P4) = { }
Preselected(P2) = Preselected(P3) = Preselected(P4) = false
Empty(P2) = false
Empty(P3) = Empty(P4) = true
Follow(one) = { "$" }
Select(P2) = First(P2) = { "two" }
Select(P3) = First(P3) + Follow(one) = { "*", "$" }
Select(P4) = First(P4) + Follow(one) = { "$" }
First(P6) = { "*" }
First(P7) = { }
Preselected(P6) = Preselected(P7) = Empty(P6) = false
Empty(P7) = true
<span class="grey">Legg Experimental [Page 77]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-78" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Follow(I1) = { "$" }
Select(P6) = First(P6) = { "*" }
Select(P7) = First(P7) + Follow(I1) = { "$" }
The intersection of Select(P3) and Select(P4) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. If the <two> element is not present, then a decoder cannot
determine whether the "one" alternative is absent, or present with an
unknown extension that generates no elements.
The non-determinism can be resolved with either a
SINGULAR-INSERTIONS, UNIFORM-INSERTIONS, or MULTIFORM-INSERTIONS
encoding instruction. The MULTIFORM-INSERTIONS encoding instruction
is the least restrictive. Consider this revised type definition:
SEQUENCE {
one [GROUP] [MULTIFORM-INSERTIONS] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
} OPTIONAL
}
The associated grammar is:
P1: S ::= one
P2: one ::= two
P8: one ::= "*" I1
P4: one ::=
P5: two ::= "two"
P6: I1 ::= "*" I1
P7: I1 ::=
This grammar leads to the following sets and predicates:
First(P2) = { "two" }
First(P8) = { "*" }
First(P4) = { }
Preselected(P2) = Preselected(P8) = Preselected(P4) = false
Empty(P2) = Empty(P8) = false
Empty(P4) = true
Follow(one) = { "$" }
Select(P2) = First(P2) = { "two" }
Select(P8) = First(P8) = { "*" }
Select(P4) = First(P4) + Follow(one) = { "$" }
First(P6) = { "*" }
First(P7) = { }
Preselected(P6) = Preselected(P7) = Empty(P6) = false
<span class="grey">Legg Experimental [Page 78]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-79" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Empty(P7) = true
Follow(I1) = { "$" }
Select(P6) = First(P6) = { "*" }
Select(P7) = First(P7) + Follow(I1) = { "$" }
The intersection of Select(P2) and Select(P8) is empty, as is the
intersection of Select(P2) and Select(P4), the intersection of
Select(P8) and Select(P4), and the intersection of Select(P6) and
Select(P7); hence, the grammar is deterministic, and the type
definition is valid. A decoder will now assume the "one" alternative
is present if it sees at least one unrecognized element, and absent
otherwise.
<span class="h3"><a class="selflink" id="appendix-B.3" href="#appendix-B.3">B.3</a>. Example 3</span>
Consider the following type definition:
SEQUENCE {
one [GROUP] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
},
three [GROUP] CHOICE {
four UTF8String,
... -- Extension insertion point (I2).
}
}
The associated grammar is:
P1: S ::= one three
P2: one ::= two
P3: one ::= I1
P4: two ::= "two"
P5: I1 ::= "*" I1
P6: I1 ::=
P7: three ::= four
P8: three ::= I2
P9: four ::= "four"
P10: I2 ::= "*" I2
P11: I2 ::=
This grammar leads to the following sets and predicates:
First(P2) = { "two" }
First(P3) = { "*" }
Preselected(P2) = Preselected(P3) = Empty(P2) = false
Empty(P3) = true
<span class="grey">Legg Experimental [Page 79]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-80" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Follow(one) = { "four", "*", "$" }
Select(P2) = First(P2) = { "two" }
Select(P3) = First(P3) + Follow(one) = { "*", "four", "$" }
First(P5) = { "*" }
First(P6) = { }
Preselected(P5) = Preselected(P6) = Empty(P5) = false
Empty(P6) = true
Follow(I1) = { "four", "*", "$" }
Select(P5) = First(P5) = { "*" }
Select(P6) = First(P6) + Follow(I1) = { "four", "*", "$" }
First(P7) = { "four" }
First(P8) = { "*" }
Preselected(P7) = Preselected(P8) = Empty(P7) = false
Empty(P8) = true
Follow(three) = { "$" }
Select(P7) = First(P7) = { "four" }
Select(P8) = First(P8) + Follow(three) = { "*", "$" }
First(P10) = { "*" }
First(P11) = { }
Preselected(P10) = Preselected(P11) = Empty(P10) = false
Empty(P11) = true
Follow(I2) = { "$" }
Select(P10) = First(P10) = { "*" }
Select(P11) = First(P11) + Follow(I2) = { "$" }
The intersection of Select(P5) and Select(P6) is not empty; hence,
the grammar is not deterministic, and the type definition is not
valid. If the first child element is an unrecognized element, then a
decoder cannot determine whether to associate it with extension
insertion point I1, or to associate it with extension insertion point
I2 by assuming that the "one" component has an unknown extension that
generates no elements.
The non-determinism can be resolved with either a SINGULAR-INSERTIONS
or UNIFORM-INSERTIONS encoding instruction. Consider this revised
type definition using the SINGULAR-INSERTIONS encoding instruction:
<span class="grey">Legg Experimental [Page 80]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-81" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
SEQUENCE {
one [GROUP] [<a href="#ref-SINGULAR-INSERTIONS" title=" two INTEGER">SINGULAR-INSERTIONS</a>] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
},
three [GROUP] CHOICE {
four UTF8String,
... -- Extension insertion point (I2).
}
}
The associated grammar is:
P1: S ::= one three
P2: one ::= two
P12: one ::= "*"
P4: two ::= "two"
P7: three ::= four
P8: three ::= I2
P9: four ::= "four"
P10: I2 ::= "*" I2
P11: I2 ::=
With the addition of the SINGULAR-INSERTIONS encoding instruction,
the P5 and P6 productions are no longer generated. The grammar leads
to the following sets and predicates for the P2 and P12 productions:
First(P2) = { "two" }
First(P12) = { "*" }
Preselected(P2) = Preselected(P12) = false
Empty(P2) = Empty(P12) = false
Follow(one) = { "four", "*", "$" }
Select(P2) = First(P2) = { "two" }
Select(P12) = First(P12) = { "*" }
The sets for P5 and P6 are no longer generated, and the remaining
sets are unchanged.
The intersection of Select(P2) and Select(P12) is empty, as is the
intersection of Select(P7) and Select(P8) and the intersection of
Select(P10) and Select(P11); hence, the grammar is deterministic, and
the type definition is valid. If the first child element is an
unrecognized element, then a decoder will now assume that it is
associated with extension insertion point I1. Whatever follows,
possibly including another unrecognized element, will belong to the
"three" component.
<span class="grey">Legg Experimental [Page 81]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-82" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Now consider the type definition using the UNIFORM-INSERTIONS
encoding instruction instead:
SEQUENCE {
one [GROUP] [<a href="#ref-UNIFORM-INSERTIONS" title=" three [GROUP] SEQUENCE SIZE(1..MAX) OF four INTEGER">UNIFORM-INSERTIONS</a>] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
},
three [GROUP] CHOICE {
four UTF8String,
... -- Extension insertion point (I2).
}
}
The associated grammar is:
P1: S ::= one three
P2: one ::= two
P13: one ::= "*"
P14: one ::= "*1" I1
P4: two ::= "two"
P15: I1 ::= "*1" I1
P6: I1 ::=
P7: three ::= four
P8: three ::= I2
P9: four ::= "four"
P10: I2 ::= "*" I2
P11: I2 ::=
This grammar leads to the following sets and predicates for the P2,
P13, P14, P15, and P6 productions:
First(P2) = { "two" }
First(P13) = { "*" }
First(P14) = { "*1" }
Preselected(P2) = Preselected(P13) = Preselected(P14) = false
Empty(P2) = Empty(P13) = Empty(P14) = false
Follow(one) = { "four", "*", "$" }
Select(P2) = First(P2) = { "two" }
Select(P13) = First(P13) = { "*" }
Select(P14) = First(P14) = { "*1" }
<span class="grey">Legg Experimental [Page 82]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-83" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
First(P15) = { "*1" }
First(P6) = { }
Preselected(P15) = Preselected(P6) = Empty(P15) = false
Empty(P6) = true
Follow(I1) = { "four", "*", "$" }
Select(P15) = First(P15) = { "*1" }
Select(P6) = First(P6) + Follow(I1) = { "four", "*", "$" }
The remaining sets are unchanged.
The intersection of Select(P2) and Select(P13) is empty, as is the
intersection of Select(P2) and Select(P14), the intersection of
Select(P13) and Select(P14) and the intersection of Select(P15) and
Select(P6); hence, the grammar is deterministic, and the type
definition is valid. If the first child element is an unrecognized
element, then a decoder will now assume that it and every subsequent
unrecognized element with the same name are associated with I1.
Whatever follows, possibly including another unrecognized element
with a different name, will belong to the "three" component.
A consequence of using the UNIFORM-INSERTIONS encoding instruction is
that any future extension to the "three" component will be required
to generate elements with names that are different from the names of
the elements generated by the "one" component. With the
SINGULAR-INSERTIONS encoding instruction, extensions to the "three"
component are permitted to generate elements with names that are the
same as the names of the elements generated by the "one" component.
<span class="h3"><a class="selflink" id="appendix-B.4" href="#appendix-B.4">B.4</a>. Example 4</span>
Consider the following type definition:
SEQUENCE OF one [GROUP] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
}
The associated grammar is:
P1: S ::= one S
P2: S ::=
P3: one ::= two
P4: one ::= I1
P5: two ::= "two"
P6: I1 ::= "*" I1
P7: I1 ::=
<span class="grey">Legg Experimental [Page 83]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-84" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
This grammar leads to the following sets and predicates:
First(P1) = { "two", "*" }
First(P2) = { }
Preselected(P1) = Preselected(P2) = false
Empty(P1) = Empty(P2) = true
Follow(S) = { "$" }
Select(P1) = First(P1) + Follow(S) = { "two", "*", "$" }
Select(P2) = First(P2) + Follow(S) = { "$" }
First(P3) = { "two" }
First(P4) = { "*" }
Preselected(P3) = Preselected(P4) = Empty(P3) = false
Empty(P4) = true
Follow(one) = { "two", "*", "$" }
Select(P3) = First(P3) = { "two" }
Select(P4) = First(P4) + Follow(one) = { "*", "two", "$" }
First(P6) = { "*" }
First(P7) = { }
Preselected(P6) = Preselected(P7) = Empty(P6) = false
Empty(P7) = true
Follow(I1) = { "two", "*", "$" }
Select(P6) = First(P6) = { "*" }
Select(P7) = First(P7) + Follow(I1) = { "two", "*", "$" }
The intersection of Select(P1) and Select(P2) is not empty, as is the
intersection of Select(P3) and Select(P4) and the intersection of
Select(P6) and Select(P7); hence, the grammar is not deterministic,
and the type definition is not valid. If a decoder encounters two or
more unrecognized elements in a row, then it cannot determine whether
this represents one instance or more than one instance of the "one"
component. Even without unrecognized elements, there is still a
problem that an encoding could contain an indeterminate number of
"one" components using an extension that generates no elements.
The non-determinism cannot be resolved with a UNIFORM-INSERTIONS
encoding instruction. Consider this revised type definition using
the UNIFORM-INSERTIONS encoding instruction:
SEQUENCE OF one [GROUP] [<a href="#ref-UNIFORM-INSERTIONS" title=" three [GROUP] SEQUENCE SIZE(1..MAX) OF four INTEGER">UNIFORM-INSERTIONS</a>] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
}
<span class="grey">Legg Experimental [Page 84]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-85" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The associated grammar is:
P1: S ::= one S
P2: S ::=
P3: one ::= two
P8: one ::= "*"
P9: one ::= "*1" I1
P5: two ::= "two"
P10: I1 ::= "*1" I1
P7: I1 ::=
This grammar leads to the following sets and predicates:
First(P1) = { "two", "*", "*1" }
First(P2) = { }
Preselected(P1) = Preselected(P2) = Empty(P1) = false
Empty(P2) = true
Follow(S) = { "$" }
Select(P1) = First(P1) = { "two", "*", "*1" }
Select(P2) = First(P2) + Follow(S) = { "$" }
First(P3) = { "two" }
First(P8) = { "*" }
First(P9) = { "*1" }
Preselected(P3) = Preselected(P8) = Preselected(P9) = false
Empty(P3) = Empty(P8) = Empty(P9) = false
Follow(one) = { "two", "*", "*1", "$" }
Select(P3) = First(P3) = { "two" }
Select(P8) = First(P8) = { "*" }
Select(P9) = First(P9) = { "*1" }
First(P10) = { "*1" }
First(P7) = { }
Preselected(P10) = Preselected(P7) = Empty(P10) = false
Empty(P7) = true
Follow(I1) = { "two", "*", "*1", "$" }
Select(P10) = First(P10) = { "*1" }
Select(P7) = First(P7) + Follow(I1) = { "two", "*", "*1", "$" }
The intersection of Select(P1) and Select(P2) is now empty, but the
intersection of Select(P10) and Select(P7) is not; hence, the grammar
is not deterministic, and the type definition is not valid. The
problem of an indeterminate number of "one" components from an
extension that generates no elements has been solved. However, if a
decoder encounters a series of elements with the same name, it cannot
determine whether this represents one instance or more than one
instance of the "one" component.
<span class="grey">Legg Experimental [Page 85]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-86" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The non-determinism can be fully resolved with a SINGULAR-INSERTIONS
encoding instruction. Consider this revised type definition:
SEQUENCE OF one [GROUP] [<a href="#ref-SINGULAR-INSERTIONS" title=" two INTEGER">SINGULAR-INSERTIONS</a>] CHOICE {
two UTF8String,
... -- Extension insertion point (I1).
}
The associated grammar is:
P1: S ::= one S
P2: S ::=
P3: one ::= two
P8: one ::= "*"
P5: two ::= "two"
This grammar leads to the following sets and predicates:
First(P1) = { "two", "*" }
First(P2) = { }
Preselected(P1) = Preselected(P2) = Empty(P1) = false
Empty(P2) = true
Follow(S) = { "$" }
Select(P1) = First(P1) = { "two", "*" }
Select(P2) = First(P2) + Follow(S) = { "$" }
First(P3) = { "two" }
First(P8) = { "*" }
Preselected(P3) = Preselected(P8) = false
Empty(P3) = Empty(P8) = false
Follow(one) = { "two", "*", "$" }
Select(P3) = First(P3) = { "two" }
Select(P8) = First(P8) = { "*" }
The intersection of Select(P1) and Select(P2) is empty, as is the
intersection of Select(P3) and Select(P8); hence, the grammar is
deterministic, and the type definition is valid. A decoder now knows
that every extension to the "one" component will generate a single
element, so the correct number of "one" components will be decoded.
<span class="grey">Legg Experimental [Page 86]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-87" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Extension and Versioning Examples</span>
This appendix is non-normative.
<span class="h3"><a class="selflink" id="appendix-C.1" href="#appendix-C.1">C.1</a>. Valid Extensions for Insertion Encoding Instructions</span>
The first example shows extensions that satisfy the HOLLOW-INSERTIONS
encoding instruction.
[<a id="ref-HOLLOW-INSERTIONS">HOLLOW-INSERTIONS</a>] CHOICE {
one BOOLEAN,
...,
two [ATTRIBUTE] INTEGER,
three [GROUP] SEQUENCE {
four [ATTRIBUTE] UTF8String,
five [ATTRIBUTE] INTEGER OPTIONAL,
...
},
six [GROUP] CHOICE {
seven [ATTRIBUTE] BOOLEAN,
eight [ATTRIBUTE] INTEGER
}
}
The "two" and "six" components generate only attributes.
The "three" component in its current form does not generate elements.
Any extension to the "three" component will need to do likewise to
avoid breaking forward compatibility.
The second example shows extensions that satisfy the
SINGULAR-INSERTIONS encoding instruction.
[<a id="ref-SINGULAR-INSERTIONS">SINGULAR-INSERTIONS</a>] CHOICE {
one BOOLEAN,
...,
two INTEGER,
three [GROUP] SEQUENCE {
four [ATTRIBUTE] UTF8String,
five INTEGER
},
six [GROUP] CHOICE {
seven BOOLEAN,
eight INTEGER
}
}
<span class="grey">Legg Experimental [Page 87]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-88" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
The "two" component will always generate a single <two> element.
The "three" component will always generate a single <five> element.
It will also generate a "four" attribute, but any number of
attributes is allowed by the SINGULAR-INSERTIONS encoding
instruction.
The "six" component will either generate a single <seven> element or
a single <eight> element. Either case will satisfy the requirement
that there will be a single element in any given encoding of the
extension.
The third example shows extensions that satisfy the
UNIFORM-INSERTIONS encoding instruction.
[<a id="ref-UNIFORM-INSERTIONS">UNIFORM-INSERTIONS</a>] CHOICE {
one BOOLEAN,
...,
two INTEGER,
three [GROUP] SEQUENCE SIZE(1..MAX) OF four INTEGER,
five [GROUP] SEQUENCE {
six [ATTRIBUTE] UTF8String OPTIONAL,
seven INTEGER
},
eight [GROUP] CHOICE {
nine BOOLEAN,
ten [GROUP] SEQUENCE SIZE(1..MAX) OF eleven INTEGER
}
}
The "two" component will always generate a single <two> element.
The "three" component will always generate one or more <four>
elements.
The "five" component will always generate a single <seven> element.
It may also generate a "six" attribute, but any number of attributes
is allowed by the UNIFORM-INSERTIONS encoding instruction.
The "eight" component will either generate a single <nine> element or
one or more <eleven> elements. Either case will satisfy the
requirement that there must be one or more elements with the same
name in any given encoding of the extension.
<span class="grey">Legg Experimental [Page 88]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-89" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
<span class="h3"><a class="selflink" id="appendix-C.2" href="#appendix-C.2">C.2</a>. Versioning Example</span>
Making extensions that are not forward compatible is permitted
provided that the incompatibility is signalled with a version
indicator attribute.
Suppose that version 1.0 of a specification contains the following
type definition:
MyMessageType ::= SEQUENCE {
version [ATTRIBUTE] [VERSION-INDICATOR]
UTF8String ("1.0", ...) DEFAULT "1.0",
one [GROUP] [<a href="#ref-SINGULAR-INSERTIONS" title=" two INTEGER">SINGULAR-INSERTIONS</a>] CHOICE {
two BOOLEAN,
...
},
...
}
An attribute is to be added to the CHOICE for version 1.1. This
change is not forward compatible since it does not satisfy the
SINGULAR-INSERTIONS encoding instruction. Therefore, the version
indicator attribute must be updated at the same time (or added if it
wasn't already present). This results in the following new type
definition for version 1.1:
MyMessageType ::= SEQUENCE {
version [ATTRIBUTE] [VERSION-INDICATOR]
UTF8String ("1.0", ..., "1.1") DEFAULT "1.0",
one [GROUP] [<a href="#ref-SINGULAR-INSERTIONS" title=" two INTEGER">SINGULAR-INSERTIONS</a>] CHOICE {
two BOOLEAN,
...,
three [ATTRIBUTE] INTEGER -- Added in Version 1.1
},
...
}
If a version 1.1 conformant application hasn't used the version 1.1
extension in a value of MyMessageType, then it is allowed to set the
value of the version attribute to "1.0".
A pair of elements is added to the CHOICE for version 1.2. Again the
change does not satisfy the SINGULAR-INSERTIONS encoding instruction.
The type definition for version 1.2 is:
<span class="grey">Legg Experimental [Page 89]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-90" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
MyMessageType ::= SEQUENCE {
version [ATTRIBUTE] [VERSION-INDICATOR]
UTF8String ("1.0", ..., "1.1" | "1.2")
DEFAULT "1.0",
one [GROUP] [<a href="#ref-SINGULAR-INSERTIONS" title=" two INTEGER">SINGULAR-INSERTIONS</a>] CHOICE {
two BOOLEAN,
...,
three [ATTRIBUTE] INTEGER, -- Added in Version 1.1
four [GROUP] SEQUENCE {
five UTF8String,
six GeneralizedTime
} -- Added in version 1.2
},
...
}
If a version 1.2 conformant application hasn't used the version 1.2
extension in a value of MyMessageType, then it is allowed to set the
value of the version attribute to "1.1". If it hasn't used either of
the extensions, then it is allowed to set the value of the version
attribute to "1.0".
Author's Address
Dr. Steven Legg
eB2Bcom
Suite 3, Woodhouse Corporate Centre
935 Station Street
Box Hill North, Victoria 3129
AUSTRALIA
Phone: +61 3 9896 7830
Fax: +61 3 9896 7801
EMail: steven.legg@eb2bcom.com
<span class="grey">Legg Experimental [Page 90]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-91" ></span>
<span class="grey"><a href="./rfc4911">RFC 4911</a> Encoding Instructions for RXER July 2007</span>
Full Copyright Statement
Copyright (C) The IETF Trust (2007).
This document is subject to the rights, licenses and restrictions
contained in <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a>, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and <a href="https://www.rfc-editor.org/bcp/bcp79">BCP 79</a>.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
<a href="http://www.ietf.org/ipr">http://www.ietf.org/ipr</a>.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
Legg Experimental [Page 91]
</pre>
|