index.html
340 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type" /><!-- processor: http://www.w3.org/Style/Group/css3-src/bin/postprocess --><title>Widget Packaging and XML Configuration</title><style type="text/css">
/*<![CDATA[*/
body {
font-size: 1em;
counter-reset: assertion;
}
dfn.external {
font-weight: normal;
font-style: italic;
}
pre.idl {
border:solid thin;
background:#eee;
color:#000;
padding:0.5em
}
pre.idl :link, pre.idl :visited {
color:inherit;
background:transparent
}
dfn {
font-style:normal;
font-weight:bolder;
}
em.ct, em.ct-samp {
text-transform:uppercase;
font-style:normal;
font-weight:normal;
}
.issue {
padding:1em;
border: 1px solid red;
background:#FFC;
}
.example {
border-left: double;
background-color: #fafafa;
}
.note {
margin-left: 2em;
border: 2px solid #CFF6D9;
padding: .5em;
padding-top: 0px;
padding-bottom: 1em;
color: #444;
background-color: #E2FFF0;
font-size: 0.8em;
}
dd > dl {
margin:0px;
padding:0px
}
code {
font-size: 1.1em;
text-decoration: none;
color: #002108;
}
a:link code, a:visited code, a > code {
color:green;
text-decoration: none;
border-bottom: 0;
}
.dir_listing li {
list-style-type:none;
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
span span {
background-color: yellow;
}
li.folder {
list-style-image:url(images/expanded_folder.png)
}
.authorguide {
border: 1px solid #67BBB5;
background:#E8EBFC;
padding: 1em;
font-size: .9em;
color: #003;
}
.authorguide strong {
padding: .2em;
color: #003;
border: none;
position:relative;
display: block;
width: 200px;
left: -1.5em;
top: -1.5em;
background: #C6D8E6;
text-align: center;
}
span.notetitle {
padding: .2em;
color:#066;
border: none;
position:relative;
display: block;
width: 40px;
left: -1.5em;
top: -.7em;
background: #F2FFF1;
padding-left: .2em;
text-align: center;
}
var {
font-family: "Lucida Console", Monaco, monospace;
}
li.folder li {
list-style-image: none;
}
.dir_listing .comment {
border: none;
font-family:"Courier New", Courier, monospace;
color: #669933;
}
.dir_listing img {
vertical-align: middle;
}
.redNote {
color: red;
}
dl.procedure dt {
font-weight: normal;
}
.editorialNote {
padding: 5px;
background-color: #F3B9B7;
border: 3px dashed #FFEEB8;
color: #444;
font-size:0.8em;
}
li>ol {
list-style-type:upper-alpha;
}
.toc li>ol {
list-style: none !important;
}
p[id]:after {
font-size: .8em;
content: " {" attr(id) "}";
}
.example p {
margin-top: 1em;
}
td, th {
border: 1px solid black;
}
/*
@media screen and (view-mode:minimized) {
body, .head {
margin: 0px !important;
padding: 10px !important;
background-position: 0px -20px !important;
text-shadow: #EEE 2px 2px 2px;
}
.body, .copyright, .head dl, hr {
display: none;
}
.head {
text-align: center;
padding-top: 10px;
}
.head h1, .head p {
margin: 0px;
padding: 0px;
background-color: transparent;
}
.head h2 {
text-align: center;
font-size: 1em;
background-color: transparent;
margin-left: 20px !important;
}
}
*/
/*]]>*/
</style><link href="http://www.w3.org/StyleSheets/TR/W3C-REC" rel="stylesheet" type="text/css" /></head><body>
<div class="head">
<p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72" /></a></p>
<!--end-logo-->
<h1 class="head">Widget Packaging and XML Configuration</h1>
<h2 class="no-num no-toc" id="w3c-recommendation-27-september-2011">W3C Recommendation 27 September 2011</h2>
<dl><dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2011/REC-widgets-20110927/">http://www.w3.org/TR/2011/REC-widgets-20110927/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/widgets/">http://www.w3.org/TR/widgets/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2011/PR-widgets-20110811/">http://www.w3.org/TR/2011/PR-widgets-20110811/</a><a href="http://www.w3.org/TR/2011/WD-widgets-20110607/"></a></dd>
<dt>Latest Editor's draft:</dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets/">http://dev.w3.org/2006/waf/widgets/</a></dd>
<dt>Test suite:</dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets/test-suite/">http://dev.w3.org/2006/waf/widgets/test-suite/</a></dd>
<dt>Implementation report:</dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets/imp-report/">http://dev.w3.org/2006/waf/widgets/imp-report/</a></dd>
<!--dt>This version:</dt>
<dd><a href=
"http://www.w3.org/TR/2011/WD-widgets-20110809/">http://www.w3.org/TR/2011/WD-widgets-20110809/</a></dd>
<dt>Latest version: </dt>
<dd><a href="http://www.w3.org/TR/widgets/">http://www.w3.org/TR/widgets/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2010/WD-widgets-20101005/">http://www.w3.org/TR/2010/WD-widgets-20101005/</a></dd-->
<dt>Editor:</dt>
<dd><a href="http://marcosc.com/">Marcos Cáceres</a>,</dd>
</dl>
<p>Please refer to the <a href="http://dev.w3.org/2006/waf/widgets/errata.html"><strong>errata</strong></a> for this document, which may include some normative corrections.</p>
<p>See also <a href=" http://www.w3.org/2003/03/Translations/byTechnology?technology=widgets"> <strong>translations</strong></a>.</p>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
</div>
<hr /><div class="body">
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>This specification standardizes a packaging format and metadata for a class of software
known as <em>widgets</em>. Unlike traditional user interface widgets (e.g., buttons, input boxes, toolbars, etc.), widgets as specified in this document are full-fledged client-side applications that are authored
using technologies such as HTML and then packaged for distribution. Examples range from
simple clocks, stock tickers, news casters, games and weather forecasters, to complex
applications that pull data from multiple sources to be "mashed-up" and presented to a
user in some interesting and useful way.</p>
<p>The
specification relies on PKWare's Zip specification as the archive format, XML as a
configuration document format, and a series of steps that runtimes follow when
processing and verifying various aspects of a package. The packaging format acts as a
container for files used by a widget. The configuration document is an XML vocabulary
that declares metadata and configuration parameters for a widget. The steps for
processing a widget package describe the expected behavior and means of error handling
for runtimes while processing the packaging format, configuration document, and other
relevant files. </p>
<p>This specification is part of the <a href="#widgets-family-of-specifications">Widgets family of specifications</a>,
which together standardize widgets as a whole.</p>
<h2 class="no-num no-toc" id="sotd">Status of this Document </h2>
<p><em>This section describes the status of this document at the time of its
publication. Other documents may supersede this document. A list of current W3C
publications and the latest revision of this technical report can be found in the
<a href="http://www.w3.org/TR/">W3C technical reports index</a> at
http://www.w3.org/TR/.</em> </p>
<p>This is the 27 September 2011 Recommendation of the <cite>Widget Packaging and XML Configuration</cite> specification. This document is produced by the <a href="http://www.w3.org/2008/webapps/">Web
Applications WG</a>, part of the <a href="http://www.w3.org/2006/rwc/Activity">Rich Web
Client Activity</a> in the W3C <a href="http://www.w3.org/Interaction/">Interaction
Domain</a>. </p>
<p>This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.</p>
<p>The public is encouraged to send comments to the WebApps Working Group's public mailing list <a href="mailto:public-webapps@w3.org">public-webapps@w3.org</a> (<a href="http://lists.w3.org/Archives/Public/public-webapps/">archive</a>). </p>
<p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/42538/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the
deliverables of the group; that page also includes instructions for disclosing a
patent. An individual who has actual knowledge of a patent which the individual
believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<h2 class="no-num no-toc" id="toc">Table of Contents</h2>
<!--begin-toc-->
<ol class="toc">
<li><a href="#introduction"><span class="secno">1 </span>Introduction</a>
<ol class="toc">
<li><a href="#design-goals-and-requirements"><span class="secno">1.1 </span>Design Goals and Requirements</a></li>
<li><a href="#how-this-document-is-organized"><span class="secno">1.2 </span>How This Document is Organized</a></li>
<li><a href="#typographic-conventions"><span class="secno">1.3 </span>Typographic Conventions</a></li>
<li><a href="#the-widget-family-of-specifications"><span class="secno">1.4 </span>The Widget Family of Specifications</a></li></ol></li>
<li><a href="#conformance"><span class="secno">2 </span>Conformance</a></li>
<li><a href="#definitions"><span class="secno">3 </span>Definitions</a>
<ol class="toc">
<li><a href="#character-definitions"><span class="secno">3.1 </span>Character Definitions</a></li></ol></li>
<li><a href="#user-agents"><span class="secno">4 </span>User Agents</a>
<ol class="toc">
<li><a href="#optional-aspects-of-the-zip-specification"><span class="secno">4.1 </span>Optional Aspects of the Zip Specification</a></li></ol></li>
<li><a href="#zip-archive"><span class="secno">5 </span>Zip Archive</a>
<ol class="toc">
<li><a href="#compression-methods"><span class="secno">5.1 </span>Compression Methods</a></li>
<li><a href="#version-of-zip-needed-to-extract-a-file-entry"><span class="secno">5.2 </span>Version of Zip Needed to Extract a File Entry</a></li>
<li><a href="#zip-relative-paths"><span class="secno">5.3 </span>Zip Relative Paths</a></li>
<li><a href="#interoperability-considerations"><span class="secno">5.4 </span>Interoperability Considerations</a></li></ol></li>
<li><a href="#widget-packages"><span class="secno">6 </span>Widget Packages</a>
<ol class="toc">
<li><a href="#invalid-widget-package"><span class="secno">6.1 </span>Invalid Widget Package</a></li>
<li><a href="#files-and-folders"><span class="secno">6.2 </span>Files and Folders</a></li>
<li><a href="#reserved-file-and-folder-names"><span class="secno">6.3 </span>Reserved File and Folder Names</a></li>
<li><a href="#digital-signatures"><span class="secno">6.4 </span>Digital Signatures</a></li>
<li><a href="#start-files"><span class="secno">6.5 </span>Start Files</a>
<ol class="toc">
<li><a href="#custom-start-file"><span class="secno">6.5.1 </span>Custom Start File</a></li>
<li><a href="#default-start-files"><span class="secno">6.5.2 </span>Default Start Files</a></li></ol></li>
<li><a href="#icons"><span class="secno">6.6 </span>Icons</a>
<ol class="toc">
<li><a href="#custom-icons"><span class="secno">6.6.1 </span>Custom Icons</a></li>
<li><a href="#default-icons"><span class="secno">6.6.2 </span>Default Icons</a></li></ol></li>
<li><a href="#media-type"><span class="secno">6.7 </span>Media Type</a></li>
<li><a href="#file-extension"><span class="secno">6.8 </span>File Extension</a></li></ol></li>
<li><a href="#configuration-document"><span class="secno">7 </span>Configuration Document</a>
<ol class="toc">
<li><a href="#example-configuration-document"><span class="secno">7.1 </span>Example Configuration Document</a></li>
<li><a href="#namespace"><span class="secno">7.2 </span>Namespace</a></li>
<li><a href="#proprietary-extensions"><span class="secno">7.3 </span>Proprietary Extensions</a></li>
<li><a href="#types-of-attributes"><span class="secno">7.4 </span>Types of Attributes</a></li>
<li><a href="#global-attributes"><span class="secno">7.5 </span>Global Attributes</a>
<ol class="toc">
<li><a href="#the-xml:lang-attribute"><span class="secno">7.5.1 </span>The <code>xml:lang</code> Attribute</a></li>
<li><a href="#the-dir-attribute"><span class="secno">7.5.2 </span>The <code>dir</code> Attribute</a></li>
<li><a href="#examples-of-usage"><span class="secno">7.5.3 </span>Examples of Usage</a></li></ol></li>
<li><a href="#the-widget-element-and-its-attributes"><span class="secno">7.6 </span>The <code>widget</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-id-attribute"><span class="secno">7.6.1 </span>The <code>id</code> Attribute</a></li>
<li><a href="#the-version-attribute"><span class="secno">7.6.2 </span>The <code>version</code> Attribute</a></li>
<li><a href="#the-height-attribute"><span class="secno">7.6.3 </span>The <code>height</code> Attribute</a></li>
<li><a href="#the-width-attribute"><span class="secno">7.6.4 </span>The <code>width</code> Attribute</a></li>
<li><a href="#the-viewmodes-attribute"><span class="secno">7.6.5 </span>The <code>viewmodes</code> Attribute</a></li>
<li><a href="#the-defaultlocale-attribute"><span class="secno">7.6.6 </span>The <code title="widget defaultlocale">defaultlocale</code> attribute</a></li>
<li><a href="#example-of-usage"><span class="secno">7.6.7 </span>Example of Usage</a></li>
<li><a href="#example-of-usage-of-the-defaultlocale-attribute"><span class="secno">7.6.8 </span>Example of Usage of the <code title="widget defaultlocale">defaultlocale</code> attribute </a></li></ol></li>
<li><a href="#the-name-element-and-its-attributes"><span class="secno">7.7 </span>The <code>name</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-short-attribute"><span class="secno">7.7.1 </span>The <code title="name short">short</code> Attribute</a></li>
<li><a href="#example-of-usage-0"><span class="secno">7.7.2 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-description-element-and-its-attributes"><span class="secno">7.8 </span>The <code>description</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#example-of-usage-1"><span class="secno">7.8.1 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-author-element-and-its-attributes"><span class="secno">7.9 </span>The <code title="">author</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-href-attribute"><span class="secno">7.9.1 </span>The <code>href</code> Attribute</a></li>
<li><a href="#the-email-attribute"><span class="secno">7.9.2 </span>The <code>email</code> Attribute</a></li>
<li><a href="#example-of-usage-2"><span class="secno">7.9.3 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-license-element-and-its-attributes"><span class="secno">7.10 </span>The <code>license</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-href-attribute-0"><span class="secno">7.10.1 </span>The <code>href</code> Attribute</a></li>
<li><a href="#example-of-usage-3"><span class="secno">7.10.2 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-icon-element-and-its-attributes"><span class="secno">7.11 </span>The <code>icon</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-src-attribute"><span class="secno">7.11.1 </span>The <code>src</code> Attribute</a></li>
<li><a href="#the-width-attribute-0"><span class="secno">7.11.2 </span>The <code>width</code> Attribute</a></li>
<li><a href="#the-height-attribute-0"><span class="secno">7.11.3 </span>The <code>height</code> Attribute</a></li>
<li><a href="#example-of-usage-4"><span class="secno">7.11.4 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-content-element-and-its-attributes"><span class="secno">7.12 </span>The <code>content</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-src-attribute-0"><span class="secno">7.12.1 </span>The <code>src</code> Attribute</a></li>
<li><a href="#the-type-attribute"><span class="secno">7.12.2 </span>The <code>type</code> Attribute</a></li>
<li><a href="#the-encoding-attribute"><span class="secno">7.12.3 </span>The <code>encoding</code> Attribute</a></li>
<li><a href="#example-of-usage-5"><span class="secno">7.12.4 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-feature-element-and-its-attributes"><span class="secno">7.13 </span>The <code>feature</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-name-attribute"><span class="secno">7.13.1 </span>The <code title="feature name">name</code> Attribute</a></li>
<li><a href="#the-required-attribute"><span class="secno">7.13.2 </span>The <code>required</code> Attribute</a></li>
<li><a href="#example-of-usage-6"><span class="secno">7.13.3 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-param-element-and-its-attributes"><span class="secno">7.14 </span>The <code>param</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-name-attribute-0"><span class="secno">7.14.1 </span>The <code>name</code> Attribute</a></li>
<li><a href="#the-value-attribute"><span class="secno">7.14.2 </span>The <code>value</code> Attribute</a></li>
<li><a href="#example-of-usage-7"><span class="secno">7.14.3 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-preference-element-and-its-attributes"><span class="secno">7.15 </span>The <code>preference</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#the-name-attribute-1"><span class="secno">7.15.1 </span>The <code>name</code> Attribute</a></li>
<li><a href="#the-value-attribute-0"><span class="secno">7.15.2 </span>The <code>value</code> Attribute</a></li>
<li><a href="#the-readonly-attribute"><span class="secno">7.15.3 </span>The <code>readonly</code> Attribute</a></li>
<li><a href="#example-of-usage-8"><span class="secno">7.15.4 </span>Example of Usage</a></li></ol></li>
<li><a href="#the-span-element-and-its-attributes"><span class="secno">7.16 </span>The <code>span</code> Element and its Attributes</a>
<ol class="toc">
<li><a href="#example-of-usage-9"><span class="secno">7.16.1 </span>Example of Usage</a></li></ol></li></ol></li>
<li><a href="#internationalization-and-localization"><span class="secno">8 </span>Internationalization and localization</a>
<ol class="toc">
<li><a href="#bidirectional-text"><span class="secno">8.1 </span>Bidirectional text</a></li>
<li><a href="#localization-model"><span class="secno">8.2 </span>Localization Model</a></li>
<li><a href="#folder-based-localization"><span class="secno">8.3 </span>Folder-based localization</a></li>
<li><a href="#element-based-localization"><span class="secno">8.4 </span>Element-Based Localization</a></li>
<li><a href="#localization-examples"><span class="secno">8.5 </span>Localization Examples</a>
<ol class="toc">
<li><a href="#simple-example"><span class="secno">8.5.1 </span>Simple Example</a></li>
<li><a href="#complex-example"><span class="secno">8.5.2 </span>Complex Example</a></li>
<li><a href="#fallback-behavior-example"><span class="secno">8.5.3 </span>Fallback Behavior Example</a></li></ol></li></ol></li>
<li><a href="#steps-for-processing-a-widget-package"><span class="secno">9 </span>Steps for Processing a Widget Package</a>
<ol class="toc">
<li><a href="#processing-rules"><span class="secno">9.1 </span>Processing Rules</a>
<ol class="toc">
<li><a href="#rule-for-verifying-a-zip-archive"><span class="secno">9.1.1 </span>Rule for Verifying a Zip Archive</a></li>
<li><a href="#rule-for-extracting-file-data-from-a-file-entry"><span class="secno">9.1.2 </span>Rule for Extracting File Data from a File Entry</a></li>
<li><a href="#rule-for-finding-a-file-within-a-widget-package"><span class="secno">9.1.3 </span>Rule for Finding a File Within a Widget Package</a></li>
<li><a href="#rule-for-determining-directionality"><span class="secno">9.1.4 </span>Rule for determining directionality</a></li>
<li><a href="#rule-for-getting-a-single-attribute-value"><span class="secno">9.1.5 </span>Rule for Getting a Single Attribute Value</a></li>
<li><a href="#rule-for-getting-a-list-of-keywords-from-an-attribute"><span class="secno">9.1.6 </span>Rule for Getting a List of Keywords From an Attribute</a></li>
<li><a href="#rule-for-verifying-a-file-entry"><span class="secno">9.1.7 </span>Rule for Verifying a File Entry</a></li>
<li><a href="#rule-for-getting-text-content"><span class="secno">9.1.8 </span>Rule for Getting Text Content</a></li>
<li><a href="#rule-for-getting-text-content-with-normalized-white-space"><span class="secno">9.1.9 </span>Rule for Getting Text Content with Normalized White Space</a></li>
<li><a href="#rule-for-parsing-a-non-negative-integer"><span class="secno">9.1.10 </span>Rule for Parsing a Non-negative Integer</a></li>
<li><a href="#rule-for-identifying-the-media-type-of-a-file"><span class="secno">9.1.11 </span>Rule for Identifying the Media Type of a File</a></li>
<li><a href="#rule-for-deriving-the-user-agent-locales"><span class="secno">9.1.12 </span>Rule for Deriving the <var>user agent locales</var></a></li>
<li><a href="#rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive"><span class="secno">9.1.13 </span>Rule for Determining if a Potential Zip Archive is a Zip
Archive</a></li></ol></li>
<li><a class="no-num done" href="#step-1-acquire-a-potential-zip-archive">Step 1 - Acquire a Potential Zip Archive</a>
<ol class="toc">
<li><a href="#acquisition-of-a-potential-zip-archive-labeled-with-a-media-type"><span class="secno">9.1.1 </span>Acquisition of a Potential Zip archive Labeled with a Media Type</a></li>
<li><a href="#acquisition-of-potential-zip-archive-not-labeled-with-a-media-type"><span class="secno">9.1.2 </span>Acquisition of Potential Zip Archive not Labeled with a Media
Type</a></li></ol></li>
<li><a class="no-num done" href="#step-2-verify-the-zip-archive">Step 2 - Verify the Zip Archive</a></li>
<li><a class="no-num" href="#step-3-set-the-configuration-defaults">Step 3 - Set the Configuration Defaults</a></li>
<li><a class="no-num done" href="#step-4-locate-and-process-the-digital-signature">Step 4 - Locate and Process the Digital Signature</a></li>
<li><a class="no-num" href="#step-5-derive-the-user-agent-s-locales">Step 5 - Derive the User Agent's Locales</a></li>
<li><a class="no-num done" href="#step-6-locate-the-configuration-document">Step 6 - Locate the Configuration Document</a></li>
<li><a class="no-num" href="#step-7-process-the-configuration-document">Step 7 - Process the Configuration
Document</a>
<ol class="toc">
<li><a href="#terminology-used-in-processing-algorithm"><span class="secno">9.1.1 </span>Terminology Used in Processing Algorithm</a></li>
<li><a href="#algorithm-to-process-a-configuration-document"><span class="secno">9.1.2 </span>Algorithm to Process a Configuration Document</a></li></ol></li>
<li><a class="no-num done" href="#step-8-locate-the-start-file">Step 8 - Locate the Start File</a></li>
<li><a class="no-num done" href="#step-9-process-the-default-icons">Step 9 - Process the Default Icons</a></li></ol></li>
<li><a class="no-num" href="#appendix">Appendix</a>
<ol class="toc">
<li><a class="no-num" href="#media-type-registration-for-application-widget">Media Type Registration for <code>application/widget</code></a></li>
<li><a class="no-num" href="#linking-to-a-widget-package-from-a-html-document">Linking To a Widget Package From a HTML Document</a></li>
<li><a class="no-num" href="#table-of-elements-and-their-attributes">Table of Elements and Their Attributes</a></li></ol></li>
<li><a class="no-num" href="#acknowledgements">Acknowledgements</a></li>
<li><a class="no-num" href="#normative-references">Normative References</a></li>
<li><a class="no-num" href="#informative-references">Informative References</a></li></ol>
<!--end-toc-->
<h2 id="introduction"><span class="secno">1 </span>Introduction</h2>
<p><em>This section is non-normative.</em></p>
<p><em>Widgets</em> are full-fledged client-side applications that are authored using
Web standards such as <a href="#html">[HTML]</a> and packaged for distribution. They are typically downloaded and
installed on a client machine or device where they run as stand-alone applications, but
they can also be embedded into Web pages and run in a Web browser. Examples range from
simple clocks, stock tickers, news casters, games and weather forecasters, to complex
applications that pull data from multiple sources to be "mashed-up" and presented to a
user in some interesting and useful way (see <a href="#widgets-landscape">[Widgets-Landscape]</a> for more
information).</p>
<p>This specification is intended to specify a part of the Web platform closely related to <a href="#html">[HTML]</a>. </p>
<h3 id="design-goals-and-requirements"><span class="secno">1.1 </span>Design Goals and Requirements</h3>
<p><em>This section is non-normative.</em></p>
<p>The design goals and requirements for this specification are documented in the<cite> </cite><a href="#widgets-requirements">[Widgets-Requirements]</a> document. </p>
<p>This document addresses
the 25 requirements relating to "<a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#widget-package-packaging">Packaging</a>" and "<a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#configuration-document">Configuration Document</a>" of the 30 April 2009 Working Draft of the <cite>Widgets Requirements</cite> Document:</p>
<ol><li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#packaging-format">Packaging
Format</a>: see <a href="#packaging-format">packaging format</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#media-type">Media
Type</a>: see the <a href="#valid-widget-media-type">valid widget media type</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#file-extension">File
Extension</a>: see <a href="#widget-file-extension">widget file extension</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#internal-abstract-structure">Internal
Abstract Structure</a>: see <a href="#zip-archive-0">Zip archive</a> and <a href="#widget-package">widget
package</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#reserved-resource-names">Reserved
Resource Names</a>: see <a href="#reserved-file-names-table">reserved file names table</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#addressing-scheme">Addressing
Scheme</a>: see <a href="#valid-path">valid path</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#multilingual-file-names">Multilingual
File Names</a>: see <a href="#zip-relative-path">Zip relative path</a>, particularly in respect to <a href="#supported" title="supported">support</a> for <a href="#utf-8">[UTF-8]</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#localization-guidelines">Localization
Guidelines</a>: see <a href="#element-based-localization-0">element-based localization</a>, <a href="#folder-based-localization-0">folder-based
localization</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#automatic-localization">Automatic
Localization</a>: see <a href="#element-based-localization-0">element-based localization</a>, <a href="#folder-based-localization-0">folder-based
localization</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#device-independent-delivery">Device
Independent Delivery</a>: all aspects of this document where developed with this
requirement in mind.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#data-compression">Data
Compression</a>: see the <a href="#valid-compression-methods">valid compression methods</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#derive-the-media-type-of-resources"> Derive the Media Type of Resources</a>: see the <a href="#rule-for-identifying-the-media-type-of-a-file-0">rule for identifying the media type of a
file</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#format-and-schema">Format and
Schema</a>: see <a href="#configuration-document-0">configuration document</a>, <a href="#table-of-configuration-defaults">table of configuration
defaults</a>, and the <a href="#widgets-relax-ng-schema">[Widgets-Relax NG Schema]</a> for the configuration
document.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#widget-metadata">Widget
Metadata</a>: see <a href="#configuration-document-0">configuration document</a> (particularly the
elements).</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#authorship-metadata">Authorship
Metadata:</a> see the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#copyright-notice-and-license-metadata"> Copyright Notice and License Metadata</a>: see the <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#visual-rendering-dimensions">Visual
Rendering Dimensions</a>: see the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#declarative-bootstrap">Declarative
Bootstrap</a> see the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#automated-bootstrap">Automated
Bootstrap</a> see the <a href="#default-start-file">default start file</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#iconic-representations">Iconic
Representations</a>: see the <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element, <a href="#default-icons-table">default icons table</a> and <a href="#custom-icon" title="custom icon">custom icons
table</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#configuration-parameters">Configuration
Parameters</a>: the <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element (used in
conjunction with the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element).</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#author-defined-start-up-values-preferences"> Author-defined Start-up Values (Preferences)</a>: see the <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#feature-access-declarations">Feature
Access Declarations</a>: see the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#configuration-document-independence"> Configuration Document Independence</a>: see <a href="#configuration-document-0">configuration
document</a>.</li>
<li><a href="http://www.w3.org/TR/2009/WD-widgets-reqs-20090430/#preferred-display-mode">Preferred
Display Mode</a>: see the <code>viewmodes</code> attribute of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</li>
</ol><h3 id="how-this-document-is-organized"><span class="secno">1.2 </span>How This Document is Organized</h3>
<p><em>This section is non-normative.</em></p>
<p>This document is organized into two halves, but not
explicitly marked as such. The first half defines the various aspects of what
constitutes the <a href="#packaging-format">packaging format</a>, the <a href="#configuration-document-0">configuration document</a>,
and <a href="#reserved">reserved</a> files, such as <a href="#default-icon" title="default icon">default
icons</a> and <a href="#locale-folder-0" title="locale folder">locale folders</a>. Where possible, the first
half avoids describing aspects related to processing, which are described in detail in
the second half of the document.</p>
<p>The second half, which starts with the section titled "<a href="#steps-for-processing-a-widget-package-0">Steps for Processing a
widget package</a>", defines the steps required to process a widget package as well
as the expected behavior of a user agent as it processes the <a href="#packaging-format">packaging format</a>, the
configuration document, and attempts to find localized content. The second half of this
document also deals with error handling in the event that a user agent encounters <a href="#unsupported">unsupported</a> or missing files, or <abbr title="Document Object Model">DOM</abbr> nodes that are <a href="#in-error">in error</a> in the
configuration document. Wherever processing is relevant, sections in the first half of
the document link to sections in the second half of the document.</p>
<h3 id="typographic-conventions"><span class="secno">1.3 </span>Typographic Conventions</h3>
<p><em>This section is non-normative.</em></p>
<p>This section defines the <dfn id="typographical-conventions">typographical conventions</dfn> used by this
specification. Some text in this specification is non-normative. Non-normative text includes:</p>
<ul><li>sections marked with the text <q><em>This section is non-normative</em></q>,</li>
<li>authoring guidelines,</li>
<li>examples,</li>
<li>and notes.</li>
</ul><p>Everything else in this specification is normative.</p>
<p>Defined terms appear as this <dfn id="sample-defined-term">sample defined
term</dfn>. Such terms are referenced as <a href="#sample-defined-term">sample defined term</a>, providing a
link back to the term definition.</p>
<p>Words that denote a conformance clause or testable assertion use keywords from <a href="#rfc2119">[RFC2119]</a>: <em class="ct-samp">must</em>, <em class="ct-samp">must not</em>, <em class="ct-samp">should</em>, <em class="ct-samp">recommended</em>, <em class="ct-samp">may</em> and <em class="ct-samp">optional</em>. The keywords <dfn title=""><em class="ct-samp">must</em></dfn>, <dfn title=""><em class="ct-samp">must not</em></dfn>, <dfn title=""><em class="ct-samp">should</em></dfn>, <dfn title=""><em class="ct-samp">recommended</em></dfn>, <dfn title=""><em class="ct-samp">may</em></dfn> and <dfn title=""><em class="ct-samp">optional</em></dfn> in this specification are to be interpreted as described in <a href="#rfc2119">[RFC2119]</a>.</p>
<p>Variables are formatted specially, e.g. <var>variable</var>. Code is also specially
formatted, such as <code>code</code>.</p>
<p>Words in <dfn class="external" id="italics">italics</dfn> denote a formal definition given in an
external specification.</p>
<p class="example">This is an example. Examples are used to explain concepts or
demonstrate how to use a feature. Examples are non-normative.</p>
<p class="note"><span class="notetitle">Note:</span> This is a note, it usually
contains useful supplementary information in a non-normative form.</p>
<p class=" authorguide"><strong>Authoring Guidelines:</strong> This is an Authoring
Guideline. Its purpose is to provide authors with best-practice authoring techniques.
Authoring guidelines are non-normative.</p>
<h3 id="the-widget-family-of-specifications"><span class="secno">1.4 </span>The Widget Family of Specifications</h3>
<p><em>This section is non-normative.</em></p>
<p>This specification is part of the <dfn id="widgets-family-of-specifications">Widgets family of specifications</dfn>,
which together standardize widgets as a whole. The <a href="http://www.w3.org/2008/webapps/wiki/WidgetSpecs">list of specifications</a> that make up the Widgets Family of Specifications can be found on the Working Group's wiki. </p>
<h2 id="conformance"><span class="secno">2 </span>Conformance</h2>
<p>There is only one class of product that can claim conformance to this
specification: a <a href="#user-agent">user agent</a>.</p>
<p class="note"> <span class="notetitle">Note:</span> Implementers can partially check their level of conformance to this specification by successfully passing the test cases of the <a href="#widgets-test-suite">[P&C-Test-Suite]</a>. Note, however, that passing all the tests in the test suite does not imply complete conformance to this specification; It only implies that the implementation conforms to aspects tested by the test suite (the test suite does not provide tests for any optional conformance clauses).</p>
<h2 id="definitions"><span class="secno">3 </span>Definitions</h2>
<p>The following terms are used throughout this specification so they are gathered here for the readers convenience. The following list of terms is not exhaustive; other terms are defined throughout this specification.</p>
<p><dfn id="arbitrary">Arbitrary</dfn> means that a character, or text string, or <code><a href="#file-name">file-name</a></code>, or <code><a href="#folder-name">folder-name</a></code> is not <a href="#reserved">reserved</a> for
the purpose of this specification.</p>
<p>An <dfn id="author">author</dfn> is a person who created a <a href="#widget-package">widget package</a> or an
authoring tool that generated a <a href="#widget-package">widget package</a>.</p>
<p><dfn id="initialization">Initialization</dfn> means a user agent procedurally stepping through the <a href="#steps-for-processing-a-widget-package-0">steps for processing a widget
package</a>.</p>
<p>A <dfn class="external" id="language-tag">language tag</dfn> is a text string that matches the production of a <code>Language-Tag</code> defined in the <a href="#bcp47">[BCP47]</a> specifications (see the <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Language Subtag
Registry</a> for an authoritative list of possible values, see also the <a href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm">Maintenance Agency for ISO 3166 country codes</a>). </p>
<p>A <dfn class="external" id="media-type-0">media type</dfn> is defined in the <a href="#mime">[MIME]</a> specification.</p>
<p><dfn id="reserved">Reserved</dfn> means that a character, or text string, or <code><a href="#file-name">file-name</a></code>, or <code><a href="#folder-name">folder-name</a></code> has a specified purpose and
semantics in this specification or in some other specification or system. The intended
purpose for any reserved thing is given when the term is used.</p>
<p><dfn id="supported">Supported</dfn> means that a user agent implements a mentioned specification,
or conformance clause, or is able to process or otherwise render mentioned <a href="#media-type-0">media
type</a>.</p>
<p><dfn id="unsupported">Unsupported</dfn> means the user agent does not implement a mentioned
specification, or <a href="#feature">feature</a>, or is unable to render or otherwise process a
mentioned <a href="#media-type-0">media type</a>.</p>
<p>A <dfn class="external" id="widget">widget</dfn> is defined by the <a href="#widgets-landscape">[Widgets-Landscape]</a> as <q>an
end-user's conceptualization of an interactive single purpose application for
displaying and/or updating local data or data on the Web, packaged in a way to allow a
single download and installation on a user's machine, mobile phone, or Internet-enabled
device</q>. Because widgets are packaged, they can be shared by users without relying
on <a href="#http">[HTTP]</a>. </p>
<h3 id="character-definitions"><span class="secno">3.1 </span>Character Definitions</h3>
<p>This section groups common sets of <a href="#unicode">[Unicode]</a> code points into definitions for the purpose processing in this
specification. </p>
<p>The <dfn id="space-characters" title="space characters">space characters</dfn> are code points:</p>
<ul><li>U+0020 SPACE,</li>
<li>U+0009 CHARACTER TABULATION (tab),</li>
<li>U+000A LINE FEED (LF),</li>
<li>U+000B LINE TABULATION,</li>
<li>U+000C FORM FEED (FF),</li>
<li>U+000D CARRIAGE RETURN (CR).</li>
</ul><p>The <dfn id="unicode-white-space-characters">Unicode white space characters</dfn> are code
points marked in the <a href="#unicode">[Unicode]</a> specification with the
property "White_Space", including (but not limited to - see <a href="#unicode">[Unicode]</a> for the authoritive list):</p>
<ul><li>The <a href="#space-characters">space characters</a></li>
<li>U+0085 NEL (control character next line)</li>
<li>U+00A0 NBSP (NO-BREAK SPACE)</li>
<li>U+1680 OGHAM SPACE MARK</li>
<li>U+180E MONGOLIAN VOWEL SEPARATOR</li>
<li>U+2000-U+200A (different sorts of spaces)</li>
<li>U+2028 LS (LINE SEPARATOR)</li>
<li>U+2029 PS (PARAGRAPH SEPARATOR)</li>
<li>U+202F NNBSP (NARROW NO-BREAK SPACE)</li>
<li>U+205F MMSP (MEDIUM MATHEMATICAL SPACE)</li>
<li>U+3000 IDEOGRAPHIC SPACE</li>
</ul><p>The <dfn id="zip-forbidden-characters">Zip forbidden
characters</dfn> are code points:</p>
<ul><li>U+0000 NUL-U+001F INFORMATION SEPARATOR 1,</li>
<li>U+007F DELETE,</li>
<li>U+003C LESS-THAN SIGN,</li>
<li>U+003E GREATER-THAN SIGN,</li>
<li>U+003A COLON,</li>
<li>U+0022 QUOTATION MARK,</li>
<li>U+002F SOLIDUS,</li>
<li>U+005C REVERSE SOLIDUS,</li>
<li>U+007C VERTICAL LINE,</li>
<li>U+003F QUESTION MARK,</li>
<li>U+002A ASTERISK,</li>
<li>U+005E CIRCUMFLEX ACCENT,</li>
<li>U+0060 GRAVE ACCENT,</li>
<li>U+007B LEFT CURLY BRACKET,</li>
<li>U+007D RIGHT CURLY BRACKET,</li>
<li>U+0021 EXCLAMATION MARK.</li>
</ul><h2 id="user-agents"><span class="secno">4 </span>User Agents</h2>
<p>A <dfn id="user-agent">user agent</dfn> is an implementation of this specification that also <a href="#supported" title="supported">supports</a> <a href="#xml">[XML]</a>, <a href="#xmlns">[XMLNS]</a>, <a href="#utf-8">[UTF-8]</a>, <a href="#unicode">[Unicode]</a>, <a href="#dom3core">[DOM3CORE]</a>, <a href="#sniff">[SNIFF]</a>, and <a href="#zip">[ZIP]</a> (see <a href="#optional-aspects-of-the-zip-specification-0">optional aspects of the Zip specification</a>). </p>
<p>In addition to <a href="#widget-package" title="widget package">widget packages</a>, a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">may</em> <a href="#supported" title="supported">support</a> other legacy and proprietary application packaging formats. </p>
<p>It is <em class="ct">optional</em> for a <a class="product-ua" href="#user-agent">user
agent</a> to <a href="#supported" title="supported">support</a> the <a href="#optional-aspects-of-the-zip-specification-0">optional aspects of the Zip specification</a>.</p>
<p class="note"><span class="notetitle">Note:</span> The user agent described in this
specification does not necessarily denote a "<dfn id="widget-user-agent">widget user agent</dfn>" at large:
that is, a user agent that implements all the specifications, and dependencies, defined
in the <a href="#widgets-family-of-specifications">Widgets Family of Specifications</a>. The user agent described is this
specification is only concerned with how to processes <a href="#zip-archive-0" title="zip archive">Zip
archives</a> and <a href="#configuration-document-0" title="configuration document">configuration
documents</a>.</p>
<h3 id="optional-aspects-of-the-zip-specification"><span class="secno">4.1 </span>Optional Aspects of the Zip Specification</h3>
<p>The <dfn id="optional-aspects-of-the-zip-specification-0">optional aspects of the Zip specification</dfn> are as follows. These aspects represent general features defined in the <a href="#zip">[ZIP]</a> specification that this specification does not make use of: </p>
<ul><li>
<p>Compression or decompression algorithms other than <a href="#deflate">[Deflate]</a> and <a href="#stored">Stored</a>.</p>
</li>
<li>
<p>Zip64 extensions.</p>
</li>
<li>
<p> Digital signature methods.</p>
</li>
<li>
<p> Decryption methods.</p>
</li>
<li>
<p> Patented aspects.</p>
</li>
</ul><h2 id="zip-archive"><span class="secno">5 </span>Zip Archive</h2>
<p> The <dfn id="zip-archive-0">Zip archive</dfn> file format, defined in the <a href="#zip">[ZIP]</a> specification, is the <dfn id="packaging-format">packaging format</dfn> for <a href="#widget-package" title="widget package">widget packages</a>.</p>
<p>A <dfn id="file-entry">file entry</dfn> is the data held by a <dfn class="external" id="local-file-header">local file
header</dfn>, <dfn class="external" id="file-data">file data</dfn>, and (optional) <dfn class="external" id="data-descriptor">data descriptor</dfn>, as defined in the <a href="#zip">[ZIP]</a> specification,
for each physical file or folder contained in a <a href="#zip-archive-0">Zip archive</a>.</p>
<p>A <dfn id="potential-zip-archive">potential Zip archive</dfn> is a data object claiming to be a <a href="#zip-archive-0">Zip archive</a>,
that has not been <a href="#rule-for-verifying-a-zip-archive-0" title="rule for verifying a zip archive">verified</a> to be a <a href="#valid-zip-archive">valid Zip archive</a>.</p>
<p>A <dfn id="valid-zip-archive">valid Zip archive</dfn> is a data object that the user agent has verified as conforming to the production of a <dfn class="external" id="x.zip-file">.Zip file</dfn> as defined by
the <cite>Zip File Format Specification</cite> <a href="#zip">[ZIP]</a> and <a href="#step-2-verify-the-zip-archive" title="step 2">meets the requirements of this specification</a> (See <a href="#step-2-verify-the-zip-archive">Step 2</a>).</p>
<p>The <dfn id="magic-numbers-for-a-zip-archive">magic numbers for a Zip
archive</dfn> is the byte sequence: <code>50 4B 03 04</code>.</p>
<h3 id="compression-methods"><span class="secno">5.1 </span>Compression Methods</h3>
<p>A <dfn id="compression-method">compression method</dfn> is the compression algorithm or storage method
that was used to encode the file data of a <a href="#file-entry">file entry</a> when the zip archive was created by the author. The compression method
that encoded the <var><a href="#file-data">file data</a></var> of a <a href="#file-entry">file entry</a> is
identified by the numeric value derived from the <dfn id="compression-method-field"><var>compression method
field</var></dfn> defined in the <a href="#zip">[ZIP]</a> specification.</p>
<p>The <dfn id="valid-compression-methods">valid compression methods</dfn>, as indicated by the <var><a href="#compression-method-field">compression
method field</a></var>, for a <a href="#file-entry">file entry</a> are:</p>
<dl><dt><code>8</code></dt>
<dd>Data is compressed using <a href="#deflate">[Deflate]</a>.</dd>
<dt><code>0</code></dt>
<dd>Data is <dfn class="external" id="stored">Stored</dfn> (no compression), as defined in the <a href="#zip">[ZIP]</a> specification.</dd>
</dl><p class="authorguide"><strong>Authoring Guidelines:</strong> To ensure
interoperability, compress <a href="#file-entry" title="file entry">file entries</a> in <a href="#zip-archive-0" title="zip archive">Zip archives</a> with <a href="#deflate">[Deflate]</a> or <a href="#stored">Stored</a> (no compression); other compression methods can result in in the
Zip archive being treated as an <a href="#invalid-widget-package-0">invalid widget package</a>. Of the valid compression methods, <a href="#deflate">[Deflate]</a> is the preferred compression method.</p>
<h3 id="version-of-zip-needed-to-extract-a-file-entry"><span class="secno">5.2 </span>Version of Zip Needed to Extract a File Entry</h3>
<p>The <dfn class="external" id="version-needed-to-extract"><var>version needed to extract</var></dfn> is the 2-byte
sequence in the <var><a href="#local-file-header">local file header</a></var> of a <a href="#file-entry">file entry</a> that
indicates the minimum supported version of the <a href="#zip">[ZIP]</a> specification
needed to extract the <a href="#file-data">file data</a>.</p>
<p>The <dfn id="valid-versions-needed-to-extract">valid versions needed to extract</dfn> values are as follows. Each value
is assigned one or more meanings by the <a href="#zip">[ZIP]</a> specification:</p>
<dl><dt>1.0</dt>
<dd>
<p>Default value specified in the <a href="#zip">[ZIP]</a> specification.</p>
</dd>
<dt>2.0</dt>
<dd>
<p>The file data is compressed using <a href="#deflate">[Deflate]</a>, or the file data is a folder, or the file has been encrypted using traditional PKWARE encryption.</p>
</dd>
</dl><p class="note"><span class="notetitle">Note:</span> If the Zip archive has been
encrypted using traditional PKWARE encryption, then the user agent will treat the Zip
archive as an <a href="#invalid-widget-package-0">invalid widget package</a> in <a href="#step-2-verify-the-zip-archive">Step 2</a>.</p>
<h3 id="zip-relative-paths"><span class="secno">5.3 </span>Zip Relative Paths</h3>
<p>A <dfn id="zip-relative-path">Zip relative path</dfn> is the variable-length string derived from the <dfn class="external" id="file-name-field"><var>file name field</var></dfn> of the <var><a href="#local-file-header">local file
header</a></var> of a <a href="#file-entry">file entry</a>.</p>
<p class="note"><span class="notetitle">Note:</span> A Zip relative path is said to
be relative as it stores the string that represents file and folder names relative to
where the Zip archive was created on a file system (e.g. <samp>images/bg.png</samp>),
as opposed to storing an absolute path (e.g. <samp>c:\images\bg.png</samp>). The
value of a Zip relative path will generally resemble the string value of a name of
the file or folder(s) on the device on which the Zip archive was created, but with
the exception of the path delimiter being a U+002F SOLIDUS "/" character. Note also
that a Zip relative path is not a URI reference; Zip relative paths need to be
converted to URI references before they can be used in context that make use of
URIs. </p>
<p>A <dfn id="valid-zip-relative-path">valid Zip relative path</dfn> is one that matches the production of <code><a href="#zip-rel-path">Zip-rel-path</a></code> in the following <a href="#abnf">[ABNF]</a>:</p>
<pre>
<code><dfn id="zip-rel-path">Zip-rel-path</dfn> = [locale-folder] *folder-name file-name /
[locale-folder] 1*folder-name
<dfn id="locale-folder">locale-folder</dfn> = %x6C %x6F %x63 %x61 %x6C %x65 %x73
"/" lang-tag "/"
<dfn id="folder-name">folder-name</dfn> = file-name "/"
<dfn id="file-name">file-name</dfn> = 1*allowed-char
<dfn id="allowed-char">allowed-char</dfn> = safe-char / zip-UTF8-char
<dfn id="zip-utf8-char">zip-UTF8-char</dfn> = UTF8-2 / UTF8-3 / UTF8-4
<dfn id="safe-char">safe-char</dfn> = ALPHA / DIGIT / SP / "$" / "%" /
"'" / "-" / "_" / "@" / "~" /
"(" / ")" / "&" / "+" / "," /
"=" / "[" / "]" / "."
<dfn id="utf8-2">UTF8-2</dfn> = %xC2-DF UTF8-tail
<dfn id="utf8-3">UTF8-3</dfn> = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) /
%xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
<dfn id="utf8-4">UTF8-4</dfn> = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) /
%xF4 %x80-8F 2( UTF8-tail )
<dfn id="utf8-tail">UTF8-tail</dfn> = %x80-BF
<dfn id="lang-tag">lang-tag</dfn> = primary-subtag *( "-" subtag )<br /><dfn id="primary-subtag">primary-subtag</dfn> = 1*8low-alpha<br /><dfn id="subtag">subtag </dfn> = 1*8(alphanum)<dfn></dfn>
<dfn id="alphanum">alphanum</dfn> = low-alpha / DIGIT<br /><dfn id="low-alpha">low-alpha </dfn> = %x61-7a
</code></pre>
<p><dfn class="external" id="alpha"><code>ALPHA</code></dfn>, <dfn class="external" id="digit"><code>DIGIT</code></dfn>, and <dfn class="external" id="sp"><code>SP</code></dfn> are defined in the <a href="#abnf">[ABNF]</a> specification (but essentially represent
alphanumerical characters and the U+0020 SPACE code point respectively).</p>
<h3 id="interoperability-considerations"><span class="secno">5.4 </span>Interoperability Considerations</h3>
<p><em>This section is non-normative.</em></p>
<p>Some issues can arise with regards to character encodings of file names, the length of zip relative paths, and the use of certain strings as file names. This sections is intended to help authors avoid potential interoperability issues. </p>
<div class="authorguide"><strong>Authoring Guideline</strong>
<h4 class="no-toc" id="paths-lengths"><span class="secno">5.4.1 </span>Paths Lengths</h4>
<p><em>This section is non-normative.</em></p>
<p>Authors need to be aware that having
excessively long path names (e.g. over 120 characters) can also result in
interoperability issues on some operating systems. This is because some operating systems have restrictions on how long a path length can be, so authors should try to keep the lengths of paths at less than 250 bytes. In addition, Unicode code points may
require more than one byte to encode a character, which can result in a path whose
length is less than 250 characters but whose size is greater than 250 bytes! </p>
<h4 class="no-toc" id="character-sets"><span class="secno">5.4.2 </span>Character sets</h4>
<p><em>This section is non-normative.</em></p>
<p>Authors need to be aware that, at the time of publication, there are
interoperability issues with regards to using characters outside the <code>safe-chars</code> range for file or folder names in a Zip archive when using
Zipping tools bundled with operating systems. The interoperability issues have
arisen from non-conforming implementations of the <a href="#zip">[ZIP]</a> specification
across operating systems: very few, if any, correctly support encoding file names
in Unicode.</p>
<p>In the case where the Zip relative path is encoded using <a href="#utf-8">[UTF-8]</a>, the <a class="external" href="#language-encoding-flag-efs">language encoding flag (EFS)</a> needs to be set.</p>
<p>If an author chooses to use the <code>utf8-chars</code>, they need to thoroughly
test their widgets on various platforms prior to distribution; otherwise it is
suggested that authors restrict file and folder names to the <code>safe-chars</code> (characters in the US-ASCII range).</p>
<h4 class="no-toc" id="file-names"><span class="secno">5.4.3 </span>File Names</h4>
<p><em>This section is non-normative.</em></p>
<p> Authors need to avoid using the <a href="#zip-forbidden-characters">Zip forbidden
characters</a> when naming the files used by a widget. These characters are reserved to
maintain interoperability across various file systems and with <a href="#uri">[URI]</a>s.</p>
<p>Authors need to avoid using the following words as either a <a href="#folder"><code>folder</code></a> or
a <a href="#file-name"><code>file-name</code></a> in a <a href="#zip-relative-path">Zip relative path</a> as they
are reserved by some operating systems (case-insensitive): CON, PRN, AUX, NUL,
COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5,
LPT6, LPT7, LPT8, LPT9, CLOCKS$. For example, the following names are ok:
"CON-tact.txt", "printer.lpt1", "DCOM1.pdf". However, "com3.txt" "Lpt1", "CoM9.gif"
would not be.</p>
<p>In addition, authors need to avoid having a "." U+002E FULL STOP as the last character of a
file or folder name as some operating systems will remove the character when the
file is extracted from the Zip archive onto the device. Furthermore, avoid having
the space character (<a href="#sp">SP</a>) at the start or end of a file name; and take
caution when using the "+" U+002B PLUS SIGN, as it might cause issues on some
operating systems.</p>
</div>
<h2 id="widget-packages"><span class="secno">6 </span>Widget Packages</h2>
<p>A <dfn id="widget-package">widget package</dfn> is a <a href="#valid-zip-archive">valid Zip
archive</a> that contains the following:</p>
<ul><li>
<p>One or more <a href="#start-file" title="start file">start files</a>, located at the <a href="#root-of-the-widget-package">root of the widget package</a> and/or at the root of <a href="#locale-folder-0" title="locale folder">locale folders</a> or referenced by a <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element's <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute.</p>
</li>
<li>
<p>One <a href="#configuration-document-0">configuration document</a>,
located at the <a href="#root-of-the-widget-package">root of the widget package</a>.</p>
</li>
<li>
<p>Zero or more <a href="#default-icon" title="default icon">icons</a>, either located at the <a href="#root-of-the-widget-package">root of the widget package</a> and/or at the root of <a href="#locale-folder-0" title="locale folder">locale folders</a> or referenced by the <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element's <code title="icon src"><a href="#the-src-attribute">src</a></code> attribute.</p>
</li>
<li>
<p>Zero or more <a href="#arbitrary">arbitrary</a> <a href="#file" title="file">files</a> located
either at the <a href="#root-of-the-widget-package">root of the widget package</a> and/or in <a href="#arbitrary">arbitrary</a> <a href="#folder" title="folder">folders</a> or in <a href="#locale-folder-0" title="locale folder">locale folders</a>.</p>
</li>
<li>
<p>Zero or more <a href="#digital-signature" title="digital signature">digital signatures</a> located at
the <a href="#root-of-the-widget-package">root of the widget package.</a></p>
</li>
</ul><p class="note"><span class="notetitle">Note:</span> See <a href="#step-1-acquire-a-potential-zip-archive">step 1</a> - Acquire
a Potential Zip Archive for instructions on how to process a widget package.</p>
<h3 id="invalid-widget-package"><span class="secno">6.1 </span>Invalid Widget Package</h3>
<p>During the <a href="#steps-for-processing-a-widget-package-0">steps for
processing a widget package</a>, certain error conditions can result in a <a href="#zip-archive-0">Zip archive</a> being treated as an <a href="#invalid-widget-package-0">invalid widget package</a>. An <dfn id="invalid-widget-package-0">invalid Widget package</dfn> is a condition whereby a Zip archive, or a file
within the Zip archive, is deemed to be corrupt beyond recovery or is non-conforming
to, or <a href="#unsupported">unsupported</a> by, this specification in such a way that it would
not be possible for the user agent to continue processing.</p>
<h3 id="files-and-folders"><span class="secno">6.2 </span>Files and Folders</h3>
<p>The <dfn id="root-of-the-widget-package">root of the widget package</dfn> is the top-most path level of the <a href="#zip-archive-0">Zip archive</a>. The root of the widget package contains <a href="#file" title="file">files</a> and <a href="#folder" title="folder">folders</a>, some of which are <a href="#reserved">reserved</a> (see <a href="#reserved-file-names-table">reserved file names table</a>).</p>
<p>A <dfn id="file">file</dfn> is the decompressed physical representation of a <a href="#file-entry">file
entry</a> (i.e., a file extracted into its physical form as it was prior to being
added to the <a href="#zip-archive-0">Zip archive</a>).</p>
<p>A <dfn id="folder">folder</dfn> is a <a href="#file-entry">file entry</a> whose <var><a href="#file-name-field">file name field</a></var> matches the production of <a href="#folder-name"><code>folder-name</code></a> in a <a href="#valid-zip-relative-path">valid Zip relative path</a> (the last character of the <var><a href="#file-name-field">file name
field</a></var> is a U+002F SOLIDUS) and whose <var><a href="#version-needed-to-extract">version needed to extract</a></var> is
2.0.</p>
<p>A <dfn id="processable-file">processable file</dfn> is a <a href="#file">file</a> that:</p>
<ul><li>
<p>Exists within the <a href="#widget-package">widget package</a>.</p>
</li>
<li>
<p>When the <a href="#rule-for-verifying-a-file-entry-0">rule for verifying a file entry</a> is applied to the file, it
returns <code>true</code>.</p>
</li>
<li>
<p>Is of a <a href="#media-type-0">media type</a> <a href="#supported">supported</a> by the user agent,
determined applying the <a href="#rule-for-identifying-the-media-type-of-a-file-0">rule for identifying the media type of a file</a> to the file in question. </p>
</li>
</ul><h3 id="reserved-file-and-folder-names"><span class="secno">6.3 </span>Reserved File and Folder Names</h3>
<p>The <a href="#reserved-file-names-table">reserved file names table</a>, below, contains a list of file names
that are <a href="#reserved">reserved</a> for some purpose by this specification. The first column
of the reserved file names table contains a case-sensitive list of file names.
The second column of the table denotes the purpose for which the file name is <a href="#reserved">reserved</a>.</p>
<table><caption>
<dfn id="reserved-file-names-table">Reserved File Names Table</dfn>
</caption>
<thead><tr><th>file name</th>
<th>Type</th>
<th>reserved for purpose</th>
</tr><tr><td>config.xml</td>
<td><a href="#file">file</a></td>
<td><a href="#configuration-document-0">Configuration document</a></td>
</tr></thead><tbody><tr><td>icon.png</td>
<td><a href="#file">file</a></td>
<td><a href="#default-icon">Default icon</a></td>
</tr><tr><td>icon.gif</td>
<td><a href="#file">file</a></td>
<td><a href="#default-icon">Default icon</a></td>
</tr><tr><td>icon.jpg</td>
<td><a href="#file">file</a></td>
<td><a href="#default-icon">Default icon</a></td>
</tr><tr><td>icon.ico</td>
<td><a href="#file">file</a></td>
<td><a href="#default-icon">Default icon</a></td>
</tr><tr><td>icon.svg</td>
<td><a href="#file">file</a></td>
<td><a href="#default-icon">Default icon</a></td>
</tr><tr><td>index.html</td>
<td><a href="#file">file</a></td>
<td><a href="#default-start-file">Default start file</a></td>
</tr><tr><td>index.htm</td>
<td><a href="#file">file</a></td>
<td><a href="#default-start-file">Default start file</a></td>
</tr><tr><td>index.svg</td>
<td><a href="#file">file</a></td>
<td><a href="#default-start-file">Default start file</a></td>
</tr><tr><td>index.xhtml</td>
<td><a href="#file">file</a></td>
<td><a href="#default-start-file">Default start file</a></td>
</tr><tr><td>index.xht</td>
<td><a href="#file">file</a></td>
<td><a href="#default-start-file">Default start file</a></td>
</tr><tr><td>locales</td>
<td><a href="#folder">folder</a></td>
<td><a href="#container-for-localized-content">Container for localized content</a></td>
</tr></tbody></table><p>Files named using the <a href="http://www.w3.org/TR/widgets-digsig/#naming-convention-for-a-distributor-signature">naming
conventions for distributor signatures</a> and the <a href="http://www.w3.org/TR/widgets-digsig/#naming-convention-for-an-author-signature">naming
convention for an author signature</a>, as defined in the <a href="#widgets-digsig">[Widgets-DigSig]</a> specification, are also reserved in this specification.</p>
<div class="authorguide">
<p><strong>Authoring Guideline:</strong> Authors are strongly encourage to package all
files, except the reserved files and the container for localized
content, within a single subdirectory named, for instance, after the
widget. This is to avoid unzipping several files into the end-user's
current working directory. Future versions of this specification may
include rules for locating index.html and config.xml within such
directories.</p>
<div class="example">
<p>For example, best-practice for packaging a widget would look something
like this:</p>
<ul class="dir_listing"><li class="widget_icon"> <img alt="widget file: " height="16" src="images/widget.png" width="16" /> boat.wgt
<ul><li class="doc_icon"><img alt="file: " height="16" src="images/text.png" width="16" /> index.html</li>
<li class="doc_icon"><img alt="configuration
document: " height="16" src="images/config.png" width="16" /> config.xml</li>
<li class="folder"><img alt="folder: " height="16" src="images/folder.png" width="16" />boat/
<ul><li class="folder"><img alt="folder: " height="16" src="images/folder.png" width="16" /> scripts/
<ul><li><img alt="script: " height="16" src="images/script.png" width="16" /> engine.js</li>
</ul></li>
<li class="folder"><img alt="folder: " height="16" src="images/folder.png" width="16" /> images/
<ul><li><img alt="icon: " height="16" src="images/image.png" width="16" /> header.png</li>
</ul></li>
</ul></li>
<li class="folder"><img alt="folder: " height="16" src="images/folder.png" width="16" /> locales/
<ul><li class="folder"><img alt="folder: " height="16" src="images/folder.png" width="16" /> en-gb/
<ul><li><img alt="folder: " height="16" src="images/folder.png" width="16" /> boat/
<ul><li class="folder"><img alt="folder: " height="16" src="images/folder.png" width="16" />images/
<ul><li><img alt="icon: " height="16" src="images/image.png" width="16" /> hearder.png</li>
</ul></li>
</ul></li>
</ul></li>
</ul></li>
</ul></li>
</ul></div>
</div>
<h3 id="digital-signatures"><span class="secno">6.4 </span>Digital Signatures</h3>
<p>A <a href="#widget-package">widget package</a> contains a <dfn id="digital-signature">digital signature</dfn>, and hence is <dfn id="digitally-signed">digitally signed</dfn>, if the widget package contains one or more <a href="#file" title="file">files</a> that conform to the <a href="#widgets-digsig">[Widgets-DigSig]</a> specification. </p>
<h3 id="start-files"><span class="secno">6.5 </span>Start Files</h3>
<p>A <dfn id="start-file">start file</dfn> designates a <a href="#file">file</a> from the widget package to be
loaded by the user agent when it instantiates the widget. This specification defines
two kinds of start file: <a href="#custom-start-file-0">custom start file</a> and <a href="#default-start-file">default start
file</a>.</p>
<h4 id="custom-start-file"><span class="secno">6.5.1 </span>Custom Start File</h4>
<p>A <dfn id="custom-start-file-0">custom start file</dfn> is a <a href="#processable-file">processable file</a> inside the <a href="#widget-package">widget package</a> identified by a <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element's <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute.</p>
<h4 id="default-start-files"><span class="secno">6.5.2 </span>Default Start Files</h4>
<p>A <dfn id="default-start-file">default start file</dfn> is a <a href="#reserved">reserved</a> <a href="#start-file">start file</a> at the <a href="#root-of-the-widget-package">root of the widget package</a> or at the root of a <a href="#locale-folder-0">locale folder</a> whose file name case-sensitively matches a file name given in the file name
column of the <a href="#default-start-files-table">default start files table</a>, and whose <a href="#media-type-0">media type</a> matches the <a href="#media-type-0">media type</a> given in the media type column of the table.</p>
<p>It is <em class="ct">optional</em> for a <a class="product-ua" href="#user-agent">user agent</a> to <a href="#supported" title="supported">support</a> the <a href="#media-type-0" title="media type">media types</a> listed in
the <a href="#default-start-files-table">default start files table</a>.</p>
<p id="ta-RRZxvvTFHx">If a user agent encounters a <a href="#file">file</a> matching a file name given in the
file name column of the <a href="#default-start-files-table">default start files table</a> in an <a href="#arbitrary">arbitrary</a> <a href="#folder">folder</a>, then <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat that file as an <a href="#arbitrary">arbitrary</a> file.</p>
<p class="example">For example,
"<code>foo/bar/index.html</code>" would be treated as an <a href="#arbitrary">arbitrary</a> <a href="#file">file</a>.</p>
<table><caption>
<dfn id="default-start-files-table">Default Start Files Table</dfn>
</caption>
<tr><th scope="col">file name</th>
<th scope="col">media type</th>
</tr><tr><td>index.htm</td>
<td>text/html</td>
</tr><tr><td>index.html</td>
<td>text/html</td>
</tr><tr><td>index.svg</td>
<td>image/svg+xml</td>
</tr><tr><td>index.xhtml</td>
<td>application/xhtml+xml</td>
</tr><tr><td>index.xht</td>
<td>application/xhtml+xml</td>
</tr></table><p class="note"><span class="notetitle">Note:</span> See <a href="#step-8-locate-the-start-file">Step 8</a> for
instructions on finding a <a href="#default-start-file">default start file</a>.</p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> Always include at least
one <a href="#start-file">start file</a> in a widget package.</p>
<h3 id="icons"><span class="secno">6.6 </span>Icons</h3>
<p>An <dfn id="icon">icon</dfn> is a <a href="#file">file</a> that is used
to represent the widget in various application contexts (e.g. the icon that the user
activates to instantiate a widget, or an icon in a dock or task bar or some other visual
context). The icon is intended to help users of visual browsers to recognize the widget
at a glance. There are two kinds of icons defined by this specification, <a href="#custom-icon" title="custom
icon">custom
icons</a> and <a href="#default-icon" title="default icon">default icons</a>.</p>
<h4 id="custom-icons"><span class="secno">6.6.1 </span>Custom Icons</h4>
<p>A <dfn id="custom-icon">custom icon</dfn> is an <a href="#icon">icon</a> explicitly declared by an author via an <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element in a <a href="#configuration-document-0">configuration document</a>. A <a href="#custom-icon">custom icon</a> can be located at the <a href="#root-of-the-widget-package">root of the widget
package</a>, or at the root of a <a href="#locale-folder-0">locale folder</a>, or in an <a href="#arbitrary">arbitrary</a> <a href="#folder">folder</a>.</p>
<h4 id="default-icons"><span class="secno">6.6.2 </span>Default Icons</h4>
<p>A <dfn id="default-icon">default icon</dfn> is a <a href="#reserved">reserved</a> <a href="#icon">icon</a>, either at the <a href="#root-of-the-widget-package">root of the widget package</a> or at the root of a <a href="#locale-folder-0">locale
folder</a>, whose file
name case-sensitively and exactly matches a file name given in the file name column of
the <a href="#default-icons-table">default icons table</a>.</p>
<table><caption>
<dfn id="default-icons-table">Default Icons Table</dfn>
</caption>
<tr><th scope="col">file name</th>
<th scope="col">media type</th>
</tr><tr><td>icon.svg</td>
<td>image/svg+xml</td>
</tr><tr><td>icon.ico</td>
<td>image/vnd.microsoft.icon</td>
</tr><tr><td>icon.png</td>
<td>image/png</td>
</tr><tr><td>icon.gif</td>
<td>image/gif</td>
</tr><tr><td>icon.jpg</td>
<td>image/jpeg</td>
</tr></table><p>It is <em class="ct">optional</em> for a <a href="#user-agent">user agent</a> to <a href="#supported" title="supported">support</a> the <a href="#media-type-0" title="media type">media types</a> listed in the <a href="#default-icons-table">default icons table</a>.</p>
<h3 id="media-type"><span class="secno">6.7 </span>Media Type</h3>
<p>The <dfn id="valid-widget-media-type">valid widget media type</dfn> is the string <code>application/widget</code>.</p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> If the protocol over
which the <a href="#widget-package">widget package</a> is transferred <a href="#supported" title="supported">supports</a> the [MIME] specification (e.g. <a href="#http">[HTTP]</a>), then make sure that the widget
is labeled with an <code>application/widget</code> media type. Failure to correctly
label a <a href="#widget-package">widget package</a> can result in the widget package being treated as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
<h3 id="file-extension"><span class="secno">6.8 </span>File Extension</h3>
<div>
<p>A <dfn id="widget-file-extension">widget file extension</dfn> is the text string that case-insensitively
matches the string "<code>.wgt</code>" (e.g. <code>.wgt</code>, <code>.WGt</code>, <code>.WgT</code>, etc. are all valid). </p>
<p class="example">For example in <code>widget.WGT</code>, the <code>".WGT</code>" component is the file extension. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> If it is anticipated
that the widget will be distributed by means lacking MIME support, then include the
widget file extension. The widget file extension is not necessary if the widget
package is labeled as a <code>application/widget</code> when served over HTTP. The <a href="#widget-file-extension">widget file extension</a> is required for widget packages on systems where it is customary for file names to include a file extension that symbolizes (or is associated with) a <a href="#media-type-0">media
type</a>.</p>
</div>
<h2 id="configuration-document"><span class="secno">7 </span>Configuration Document</h2>
<p>A <dfn id="configuration-document-0">configuration document</dfn> is an <a href="#xml">[XML]</a> document that has a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element at its root that is in the <a href="#widget-namespace">widget namespace</a>. A widget package has exactly
one configuration document located at the <a href="#root-of-the-widget-package">root
of the widget package</a>.</p>
<p class="note"><span class="notetitle">Note:</span> Please see <a href="#step-7-process-the-configuration-document">Step 7</a> for
details of how the elements of the <a href="#configuration-document-0">configuration document</a> are processed by
a user agent.</p>
<p>A <dfn id="valid-configuration-document-file-name">valid configuration document file name</dfn> is the string <code>config.xml</code>. </p>
<p id="ta-dxzVDWpaWg">A <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat any <a href="#file">file</a> in an <a href="#arbitrary">arbitrary</a> <a href="#folder">folder</a> or <a href="#locale-folder-0" title="locale folder">locale folders</a> that uses the
file name <code>config.xml</code> as an <a href="#arbitrary">arbitrary</a> file.</p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> Be sure to always include
a <a href="#configuration-document-0">configuration document</a> at the <a href="#root-of-the-widget-package">root of the widget package</a> and that the <code>config.xml</code> file name is in lowercase form. To ensure interoperability, encode the <a href="#configuration-document-0">configuration document</a> as <a href="#utf-8">[UTF-8]</a>.</p>
<h3 id="example-configuration-document"><span class="secno">7.1 </span>Example Configuration Document</h3>
<p>The following is an example of a typical <a href="#configuration-document-0">configuration document</a>:</p>
<div class="example">
<pre>
<code><?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
id = "http://example.org/exampleWidget"
version = "2.0 Beta"
height = "200"
width = "200"
viewmodes = "fullscreen">
<name short="Example 2.0">
The example Widget!
</name>
<feature name="http://example.com/camera">
<param name="autofocus" value="true"/>
</feature>
<preference name = "apikey"
value = "ea31ad3a23fd2f"
readonly = "true" />
<description>
A sample widget to demonstrate some of the possibilities.
</description>
<author href = "http://foo-bar.example.org/"
email = "foo-bar@example.org">Foo Bar Corp</author>
<icon src="icons/example.png"/>
<icon src="icons/boo.png"/>
<content src="myWidget.html"/>
<license>
Example license (based on MIT License)
Copyright (c) 2008 The Foo Bar Corp.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
INSULT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</license>
</widget></code></pre>
</div>
<p class="note"><span class="notetitle">Note:</span> Implementers are encouraged to
expose relevant information provided by the <a href="#configuration-document-0">configuration document</a> to the
user. Having "visual metadata" encourages authors to make full use of the configuration
document format. See <a href="#step-7-process-the-configuration-document">Step 7</a> for instructions on how to process a
configuration document.</p>
<div class="authorguide">
<p><strong>Authoring Guidelines:</strong> The only mandatory element in a configuration document is the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element. All other elements and their respective attributes are optional. The following example shows the smallest possible configuration document that a user agent will be able to process. The reason to include this sole element is to explicitly inform a user agent or conformance checker that this zip file attempts to conform to this specification. </p>
<div class="example">
<pre><code>
<!-- example of the smallest possible conforming configuration document -->
<widget xmlns="http://www.w3.org/ns/widgets"/></code></pre>
</div>
</div>
<h3 id="namespace"><span class="secno">7.2 </span>Namespace</h3>
<p>The <dfn id="widget-namespace">widget namespace</dfn> URI for a <a href="#configuration-document-0">configuration document</a> is <code>http://www.w3.org/ns/widgets</code> <a href="#xmlns">[XMLNS]</a>.</p>
<p>No provision is made for an explicit version number in this specification. If a future version of this specification requires explicit versioning of the document format, a different namespace will be used.</p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> Be sure to declare
the widget namespace as part of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element. If the namespace is absent, then the widget will be treated by the user agent as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
<h3 id="proprietary-extensions"><span class="secno">7.3 </span>Proprietary Extensions</h3>
<p><em>This section is non-normative</em>.</p>
<p> Implementers or authors intending to extend the <a href="#configuration-document-0">configuration document</a> format with
their own <a href="#xml">[XML]</a> elements and attributes (or those defined in other
specifications) can do so by using a separate <a href="#xmlns">[XMLNS]</a> namespace. This specification does not define a model for processing <a href="#xml">[XML]</a> elements outside the <a href="#widget-namespace">widget namespace</a> (they are simply <a href="#ignore" title="ignore">ignored</a> during processing).</p>
<div class="example">
<p>Example of extending the <a href="#configuration-document-0">configuration document</a> format:</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets"
<strong>xmlns:ex="http://example.org/"</strong>>
<icon src="idle.png" <strong> ex:role="inactive"/>
</strong><icon src="big.png" <strong>ex:role="big"</strong>/>
<strong><ex:datasource>{'a':'b','c':'d'}</ex:datasource></strong>
<content src="widget.html"/>
</widget></code></pre>
</div>
<h3 id="types-of-attributes"><span class="secno">7.4 </span>Types of Attributes</h3>
<p>This section defines the different <dfn id="attribute-types">attribute types</dfn> used in the <a href="#configuration-document-0">configuration document</a> and what constitutes valid values for those
attribute types. </p>
<p>An attribute is <dfn id="invalid">invalid</dfn> if its value does not conform to its said <a href="#attribute-types" title="attribute types">attribute type</a>; that is, if the value of the
attribute is <a href="#in-error">in error</a> given the processing rules for that type of
attribute. </p>
<dl><dt><dfn id="boolean-attribute">Boolean attribute</dfn></dt>
<dd>
<p>A boolean attribute is a <a href="#keyword-attribute">keyword attribute</a> that can only be used
with a valid boolean value. A <dfn id="valid-boolean-value">valid boolean value</dfn> is a <a href="#keyword">keyword</a> that
case-sensitively matches <code>true</code> or <code>false</code>. Unless specified
otherwise, the default behavior, which is used when the attribute is omitted or has
a value other than the two allowed values, is <code>false</code>. The way a user
agent interprets a boolean attribute is defined as part of an attribute's
definition (see, for example, the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element's <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute). </p>
</dd>
<dt><dfn id="string-attribute">String attribute</dfn></dt>
<dd>
<p>The value of a string attribute is any string that conforms to <a href="#xml">[XML]</a> as a valid string for an XML attribute. The purpose of this attribute type is to classify strings that are not affected by the <code title="dir"><a href="#the-dir-attribute">dir</a></code> attribute, such as the <code title="author email"><a href="#the-email-attribute">email</a></code> attribute (i.e., these attributes will not treated as <a href="#displayable-string-attribute" title="Displayable-string attribute">displayable-strings</a> during <a href="#step-7-process-the-configuration-document">Step 7</a>). </p>
</dd>
<dt><dfn id="displayable-string-attribute">Displayable-string attribute</dfn></dt>
<dd>
<p>An attribute whose primary purpose is to convey human readable information, such as the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element's <code title="name short"><a href="#the-short-attribute">short</a></code> attribute and the widget element's <code title="widget version"><a href="#widget-version">version</a></code> attribute. </p>
</dd>
<dt><dfn id="keyword-attribute">Keyword attribute</dfn></dt>
<dd>
<p>A <dfn id="keyword">keyword</dfn> is a string that is <a href="#reserved">reserved</a> for the purpose
of this specification. The value of a keyword attribute is a <a href="#keyword">keyword</a> that is one of a finite set specified in the attribute's definition in the case
given in this specification. </p>
</dd>
<dt><dfn id="keyword-list-attribute">Keyword list attribute</dfn></dt>
<dd>
<p>An attribute defined as taking one or more <a href="#keyword" title="keyword">keywords</a> as a value, which are separated by <a href="#space-characters">space characters</a>. </p>
</dd>
<dt><dfn id="media-type-attribute">Media type attribute</dfn></dt>
<dd>
<p>An attribute whose value is defined as containing a valid media type. A <dfn id="valid-media-type">valid media type</dfn> is string that matches the production for <code><a href="#valid-mime-type">valid-MIME-type</a></code> in the following <a href="#abnf">[ABNF]</a>:</p>
<pre>
<code><dfn id="valid-mime-type">valid-MIME-type</dfn> = type "/" subtype *(";" parameter)</code></pre>
<p>The <dfn class="external" id="mime-type-part" title="mime type-part"><code>type</code></dfn>, <dfn class="external" id="mime-subtype-part" title="mime subtype-part"><code>subtype</code></dfn>, and <dfn class="external" id="mime-parameter" title="mime parameter"><code>parameter</code></dfn> tokens are defined in the <a href="#mime">[MIME]</a> specification.</p>
</dd>
<dt><dfn id="language-attribute">Language attribute</dfn></dt>
<dd>
<p>An attribute whose value is defined as containing a <dfn id="valid-language-tag">valid language tag</dfn> (see the <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Language Subtag
Registry</a> for an authoritative list of possible values, see also the <a href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm">Maintenance Agency for ISO 3166 country codes</a>). A valid language tag is a string that conforms to the production of a <code>Language-Tag</code>, as defined in the <a href="#bcp47">[BCP47]</a> specification.</p>
</dd>
<dt><dfn id="numeric-attribute">Numeric attribute</dfn></dt>
<dd>
<p>The value of a numeric attribute is a string containing a valid non-negative
integer. A <dfn id="valid-non-negative-integer">valid non-negative integer</dfn> is a string that consists of one
or more code points in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).
For example, the strings "002", "323", "23214", and so on. </p>
</dd>
<dt><dfn id="path-attribute">Path attribute</dfn></dt>
<dd>
<p>An attribute defined as containing a valid path. A <dfn id="valid-path">valid
path</dfn> is one that matches the production of a <code><a href="#zip-rel-path">Zip-rel-path</a></code> or a <code>Zip-abs-path</code>. </p>
</dd>
<dd>
<p class="authorguide"><strong>Authoring Guidelines:</strong> A valid path is not a URI: a valid path represents a
hierarchical path to a file inside a <a href="#zip-archive-0">Zip archive</a>, which exactly matches the value of a <var><a href="#file-name-field">file name
field</a></var> of a <var><a href="#local-file-header">local file header</a></var> of a <a href="#file-entry">file entry</a>. This means that valid paths need not be URL encoded.</p>
</dd>
<dt><dfn id="iri-attribute">IRI attribute</dfn></dt>
<dd>
<p>An attribute defined as containing a valid IRI. A <dfn id="valid-iri">valid IRI</dfn> is one
that matches the <code><a href="#iri">IRI</a></code> token of the <a href="#iri">[IRI]</a> specification. </p>
</dd>
<dd>
<p class=" authorguide"><strong>Authoring Guidelines:</strong> Because of the risk of confusion between IRIs that would be equivalent if dereferenced, the use of %-escaped characters in feature names is strongly discouraged. </p>
</dd>
<dt><dfn id="version-attribute">Version attribute</dfn></dt>
<dd>
<p>A <a href="#displayable-string-attribute">displayable-string attribute</a> whose value is any arbitrary string value (possibly empty) within the constraints allowed for <a href="#xml">[XML]</a> attributes. This
specification does not mandate any specific format, semantics, or special
processing rule for the format of a <a href="#version-attribute">version attribute</a>. </p>
</dd>
<dd class="authorguide">
<p><strong>Authoring Guidelines:</strong> For the purpose of this specification, the
structure of version tags has no semantics; they are just treated as arbitrary
strings (e.g. '1.0' is not less than '2.0', but is simply different). However,
for the sake of consistency, one can choose to use the following <a href="#abnf">[ABNF]</a>:</p>
<pre>
<code>rec-version-tag = 1*DIGIT "." 1*DIGIT [ "." 1*DIGIT]<br /> *[ 1*ALPHA / SP / 1*DIGIT ]</code></pre>
<dl class="example"><dt>Example version tags:</dt>
<dd>
<ul><li><code>Version 1.0 Beta</code></li>
<li><code>1.0 RC1</code></li>
<li><code>1.0-Build/1580</code></li>
<li><code>Joey the dog [5.1.2100]</code></li>
</ul></dd>
<dt>Example of <code>rec-version-tag:</code></dt>
<dd>
<ul><li><code>1.0</code></li>
<li><code>1.10.1</code> <code>beta1</code></li>
<li><code>1.02.12 RC1</code></li>
</ul></dd>
</dl></dd>
</dl><h3 id="global-attributes"><span class="secno">7.5 </span>Global Attributes</h3>
<p>This section describes the behavior and expected usage of other relevant attributes
that are part of the <a href="#xml">[XML]</a> specification and this specification. In this specification, these attributes are referred to as <dfn id="global-attributes-0">global attributes</dfn> because they can be used on any element in a <a href="#configuration-document-0">configuration document</a>. </p>
<p>Although <a href="#global-attributes-0">global attributes</a> can be used on any element in this specification, they sometimes have no effect on the element on which they are used. For example, applying <code><a href="#the-dir-attribute">dir</a></code> attribute on an <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element will have no effect on the <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> elements or any of its attributes. What effect specifying a global attribute has on an elements is determined by <a href="#step-7-process-the-configuration-document">Step 7</a> of this specification.</p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> Although it is optional for an author to use any global attributes, their usage is recommended when appropriate (e.g., when declaring the language will help with legibility and when directional information will assist the user agent render text correctly). </p>
<h4 id="the-xml:lang-attribute"><span class="secno">7.5.1 </span>The <dfn><code>xml:lang</code></dfn> Attribute</h4>
<p>A <a href="#language-attribute">language attribute</a> that specifies, through a <a href="#language-tag">language
tag</a>, the language of the contents and attribute values of XML elements (see the <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Language Subtag
Registry</a>). The <a href="#xml">[XML]</a> specification specifies the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute and its influence on child nodes. </p>
<div class="authorguide">
<p><strong>Authoring Guidelines:</strong> Although <a href="#bcp47">[BCP47]</a> recommends that language tags be casefolded in a particular way for presentation, case has no meaning in a language tag. As a reminder to authors that user-agents map all language tags to lowercase, all examples in this document use lowercase. See also <a href="#folder-based-localization-0">folder-based localization</a>, which also requires authors to use language tags in lowercase form as the names of folders.</p>
<p>Avoid subtags from the <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Language Subtag
Registry</a> marked as deprecated, grandfathered, or redundant. The intended
purpose of the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute is to declare the primary language
of an element, its attributes, and its descendent nodes; as such, it has no implication with regards to the directionality of the text in the user agent. To specify the directionality of text, see the <code><a href="#the-dir-attribute">dir</a></code> attribute. </p>
</div>
<h4 id="the-dir-attribute"><span class="secno">7.5.2 </span>The <dfn><code>dir</code></dfn> Attribute</h4>
<p>A <a href="#keyword-attribute">keyword attribute</a> used to specify the directionality in which human-readable text is to be represented by a user agent (e.g., the text content of the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element, the <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element, and the <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element). The directionality set by the <code><a href="#the-dir-attribute">dir</a></code> attribute applies to the text content and any <a href="#displayable-string-attribute" title="displayable-string attribute">displayable string</a> attributes of the element where it is used, and to child elements in its content unless overridden with another instance of <code><a href="#the-dir-attribute">dir</a></code> (i.e., in this specification, the <code><a href="#the-dir-attribute">dir</a></code> attribute only affects the <code title="name short"><a href="#the-short-attribute">short</a></code> attribute of the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element and to the <code title="widget version"><a href="#widget-version">version</a></code> attribute of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element). </p>
<p>The possible value of a <code><a href="#the-dir-attribute">dir</a></code> attribute is one of the <dfn id="valid-directional-indicators">valid directional indicators</dfn>:</p>
<dl><dt><code><dfn id="ltr">ltr</dfn></code></dt>
<dd>
<p>Left-to-right text. Request that the Unicode <a href="#bidi">[BIDI]</a> algorithm treat characters within an element as embedded left-to-right.</p>
</dd>
<dt><code><dfn id="rtl">rtl</dfn></code></dt>
<dd>
<p>Right-to-left text. Request that the Unicode <a href="#bidi">[BIDI]</a> algorithm treat characters within an element as embedded right-to-left.</p>
</dd>
<dt><code><dfn id="lro">lro</dfn></code></dt>
<dd>
<p> Left-to-right override. Forces the Unicode <a href="#bidi">[BIDI]</a> algorithm to treat characters within an element as strong left-to-right characters.</p>
</dd>
<dt><code><dfn id="rlo">rlo</dfn></code></dt>
<dd>
<p>Right-to-left override. Forces the Unicode <a href="#bidi">[BIDI]</a> algorithm to treat characters within an element as strong right-to-left characters.</p>
</dd>
</dl><p class="note"><span class="notetitle">Note:</span>For security reasons, implementations intending to display <abbr title="Internationalized Resource Identifiers">IRIs</abbr> and <abbr title="Internationalized domain name">IDNA</abbr> addresses found in the configuration document are strongly encouraged to follow the security advice given in <a href="#refsUTR">[UTR36]</a>. This could include, for example, behaving as if the <code><a href="#the-dir-attribute">dir</a></code> attribute had no effect on any <a href="#iri-attribute" title="IRI attribute">IRI attributes</a>, <a href="#path-attribute" title="path attribute">path attributes</a>, and the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element's <code title="author email"><a href="#the-email-attribute">email</a></code> attribute.</p>
<p>The base direction of a <code><a href="#the-dir-attribute">dir</a></code> attribute is either set explicitly by the nearest parent element that uses the <code><a href="#the-dir-attribute">dir</a></code> attribute; or, in the absence of such an attribute, the base direction is inherited from the <dfn id="default-direction-of-the-document">default direction of the document</dfn>, which is left-to-right ("<code><a href="#ltr">ltr</a></code>"). </p>
<h4 id="examples-of-usage"><span class="secno">7.5.3 </span>Examples of Usage</h4>
<div class="example">
<p>The following example demonstrates the <code><a href="#the-dir-attribute">dir</a></code> attribute being applied globally to a <a href="#configuration-document-0">configuration document</a>. </p>
<pre><code><widget xmlns="http://www.w3.org/ns/widgets" dir="rtl" xml:lang="fa">
<name short="آب و هوا">
آب و هوا برنامه</name>
<description>
<span dir="rtl">این نرم افزار به شما اجازه می دهد تا برای دیدن آب و هوا در منطقه محلی تان.</span>
</description>
</widget></code></pre>
<p>The following example shows the <code><a href="#the-dir-attribute">dir</a></code> attribute applied to <a href="#localized-content">localized content</a>. </p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name short="Weather">
Weather Application
</name>
<name short="<span dir="rtl">آب و هوا</span>" xml:lang="fa" dir="rtl">
<span dir="rtl"> آب و هوا برنامه
</span></name>
</widget></code></pre>
<p>The following example shows the <code><a href="#the-dir-attribute">dir</a></code> attribute used with mixed language content: </p>
<pre>
<code>
<widget xmlns="http://www.w3.org/ns/widgets">
<name short="Weather">
Weather! a totally awesome application!
</name>
<name short="آب و هوا" xml:lang="fa" dir="rtl">
<span dir="ltr" xml:lang="en">Weather!</span> برنامه واقعا بزرگ
</name>
</widget></code></pre>
</div>
<h3 id="the-widget-element-and-its-attributes"><span class="secno">7.6 </span>The <dfn title="widget element"><code>widget</code></dfn> Element and its Attributes</h3>
<p>The <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element serves as a container for the
other elements of the <a href="#configuration-document-0">configuration document</a>.</p>
<dl><dt>Context in which this element is used:</dt>
<dd> The <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element is the root element of a <a href="#configuration-document-0">configuration document</a>. </dd>
<dt>Occurrences:</dt>
<dd> Exactly one, at the root element of the <a href="#xml">[XML]</a> document. </dd>
<dt>Expected children (in any order):</dt>
<dd><code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code>: zero or more (<a href="#one-element-is-allowed-per-language">one element is
allowed per language</a>).</dd>
<dd><code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code>: zero or more (<a href="#one-element-is-allowed-per-language">one
element is allowed per language</a>).</dd>
<dd><code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code>: zero or one.</dd>
<dd><code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code>: zero or more (<a href="#one-element-is-allowed-per-language">one element is
allowed per language</a>).</dd>
<dd><code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code>: zero or more.</dd>
<dd><code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code>: zero or one.</dd>
<dd><code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code>: zero or more.</dd>
<dd><code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code>: zero or more.</dd>
<dt>Localizable via xml:lang:</dt>
<dd> No. Inheritance of the value of this attribute by <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code>, <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code>, <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code>, and <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> will have no effect during processing in <a href="#step-7-process-the-configuration-document">Step 7</a>.</dd>
<dt>Attributes:</dt>
<dd> <a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="widget id"><a href="#the-id-attribute">id</a></code>, <code title="widget version"><a href="#widget-version">version</a></code>, <code title="widget height"><a href="#widget-height">height</a></code>, <code title="widget width"><a href="#widget-width">width</a></code>, <code title="widget viewmodes"><a href="#the-viewmodes-attribute">viewmodes</a></code>. </dd>
</dl><h4 id="the-id-attribute"><span class="secno">7.6.1 </span>The <code><dfn title="widget id">id</dfn></code> Attribute</h4>
<p>An <a href="#iri-attribute">IRI attribute</a> that denotes an identifier for the widget. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="widget id"><a href="#the-id-attribute">id</a></code> attribute with a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</p>
<h4 id="the-version-attribute"><span class="secno">7.6.2 </span>The <code><dfn title="widget-element version">version</dfn></code> Attribute</h4>
<p>A <a href="#version-attribute">version attribute</a> that specifies the version of the widget. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="widget-element version"><a href="#the-version-attribute">version</a></code> attribute with a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</p>
<h4 id="the-height-attribute"><span class="secno">7.6.3 </span>The <code><dfn title="widget-element height">height</dfn></code> Attribute</h4>
<p>A <a href="#valid-non-negative-integer" title="valid non-negative integer">numeric attribute</a> greater than <code>0</code> that indicates the preferred <a href="#viewport">viewport</a> height of the
instantiated <a href="#custom-start-file-0">custom start file</a> in <a href="http://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#length-units">CSS pixels</a> <a href="#css2">[CSS2]</a>. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="widget-element height"><a href="#the-height-attribute">height</a></code> attribute with a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</p>
<h4 id="the-width-attribute"><span class="secno">7.6.4 </span>The <code><dfn title="widget-element width">width</dfn></code> Attribute</h4>
<p>A <a href="#valid-non-negative-integer" title="valid non-negative integer">numeric attribute</a> greater than <code>0</code> that indicates the preferred <a href="#viewport">viewport</a> width of the
instantiated <a href="#custom-start-file-0">custom start file</a> in <a href="http://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#length-units">CSS pixels</a> <a href="#css2">[CSS2]</a>. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="widget-element width"><a href="#the-width-attribute">width</a></code> attribute with a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element. </p>
<h4 id="the-viewmodes-attribute"><span class="secno">7.6.5 </span>The <code><dfn title="widget viewmodes">viewmodes</dfn></code> Attribute</h4>
<p>A <a href="#keyword-list-attribute">keyword list attribute</a> that denotes the author's
preferred view mode, followed by the next most preferred view mode and so forth. When the attribute is missing, or is left empty, it implies that the author expects the user agent to select an appropriate viewmode for the widget.</p>
<p>The concept of a <dfn class="external" id="viewport">viewport</dfn> is defined in <a href="#css2">[CSS2]</a>, but is essentially a window or other viewing area on the screen (see section <a href="http://www.w3.org/TR/2008/REC-CSS2-20080411/visuren.html#q2">9.1.1 The viewport</a> of <a href="#css2">[CSS2]</a>). The concept of a <dfn class="external" id="view-mode">view mode</dfn> is defined in the <a href="#view-modes">[View-Modes]</a> specification.</p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="widget viewmodes"><a href="#the-viewmodes-attribute">viewmodes</a></code> attribute with a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</p>
<h4 id="the-defaultlocale-attribute"><span class="secno">7.6.6 </span>The <code title="widget defaultlocale"><dfn title="widget defaultlocale">defaultlocale</dfn></code> attribute</h4>
<p>A <a href="#language-attribute">language attribute</a> that specifies, through a <a href="#language-tag">language
tag</a>, the author's preferred locale for the widget. Its intended use is to provide a fallback in case the user agent cannot match any of the widget's <a href="#localized-content">localized content</a> to the <var><a href="#user-agent-locales">user agent locales</a></var> list or in case the author has not provided any unlocalized content. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="widget id"><a href="#the-id-attribute">defaultlocale</a></code> attribute with a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element. </p>
<h4 id="example-of-usage"><span class="secno">7.6.7 </span>Example of Usage</h4>
<div class="example">
<p>The following example shows how the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element can be used.</p>
<pre>
<code><strong><widget xmlns = "http://www.w3.org/ns/widgets"
id = "http://example.org/exampleWidget"
version = "2.0 Beta"
height = "200"
width = "200"
viewmodes = "windowed floating"/</strong><strong title="">></strong></code></pre>
</div>
<h4 id="example-of-usage-of-the-defaultlocale-attribute"><span class="secno">7.6.8 </span>Example of Usage of the <code title="widget defaultlocale"><a href="#the-defaultlocale-attribute">defaultlocale</a></code> attribute </h4>
<div class="example">
<p>The following example shows how the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element's <code title="widget defaultlocale"><a href="#the-defaultlocale-attribute">defaultlocale</a></code> attribute can be used: </p>
<pre>
<widget xmlns = "http://www.w3.org/ns/widgets"
<strong>defaultlocale</strong> = "en-us">
<code> <name short="Weather" xml:lang="en-us">
The Ultimate Weather Widget
</name>
<name short="Boletim" xml:lang="pt">
Boletim Metereológico
</name></code>
</widget></pre>
</div>
<h3 id="the-name-element-and-its-attributes"><span class="secno">7.7 </span>The <dfn title="name element"><code>name</code></dfn> Element and its Attributes</h3>
<p>The <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element represents the full
human-readable name for a <a href="#widget">widget</a> that is used, for example, in an
application menu or in other contexts.</p>
<dl><dt>Context in which this element is used:</dt>
<dd>In a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Any.</dd>
<dt>Occurrences:</dt>
<dd>Zero or more (<a href="#one-element-is-allowed-per-language">one element is allowed per language</a>).</dd>
<dt>Expected children:</dt>
<dd><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code>: zero or more.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>Yes.</dd>
<dd>
<p class="authorguide"><strong>Authoring Guidelines:</strong> The value of the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute needs to be unique for any subsequent element of this type.</p>
</dd>
<dt>Attributes:</dt>
<dd> <a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="name short"><a href="#the-short-attribute">short</a></code>.</dd>
</dl><h4 id="the-short-attribute"><span class="secno">7.7.1 </span>The <dfn title="name short"><code title="name short">short</code></dfn> Attribute</h4>
<p>A <a href="#displayable-string-attribute">displayable-string attribute</a> intended to represent a condensed name for a widget (e.g., a name that could be used in context were only limited space is available, such as underneath an icon). </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="name short"><a href="#the-short-attribute">short</a></code> attribute with an <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element.</p>
<h4 id="example-of-usage-0"><span class="secno">7.7.2 </span>Example of Usage</h4>
<div class="example">
<p>The following example shows the usage of the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<strong><name short="Weather">
The Ultimate Weather Widget
</name>
<name short="Boletim" xml:lang="pt">
Boletim Metereológico
</name></strong>
</widget></code></pre>
</div>
<h3 id="the-description-element-and-its-attributes"><span class="secno">7.8 </span>The <dfn title="description element"><code>description</code></dfn> Element and its Attributes</h3>
<p>The <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element represents a
human-readable description of the widget.</p>
<!-- metadata element -->
<dl><dt>Context in which this element is used:</dt>
<dd>In a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Any.</dd>
<dt>Occurrences:</dt>
<dd>Zero or more (<a href="#one-element-is-allowed-per-language">one element is allowed per language</a>).</dd>
<dt>Expected children:</dt>
<dd><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code>: zero or more.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>Yes.</dd>
<dd>
<p class="authorguide"><strong>Authoring Guidelines:</strong> The value of the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute needs to be unique for any subsequent element of this type. If two or more elements with the same xml:lang attribute value are encountered, the user agent will <a href="#ignore">ignore</a> all but the matching first element. See <a href="#step-7-process-the-configuration-document">Step 7</a> for more details. </p>
</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>.</dd>
</dl><h4 id="example-of-usage-1"><span class="secno">7.8.1 </span>Example of Usage</h4>
<div class="example">
<p>An example usage of the description element.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name>Dahut Chaser</name>
<strong><description>
Combining the latest weather info with your GPS position,
this widget alerts you of any significant dahut activity in your
area. When a big one walks by, the widget plots the best route on a map based
on the dahut's trajectory so you can chase it! With support for
built-in cameras, you can quickly upload all the Alpine action to
your blog or to the insane dahut chaser web site! Awesome!
</description></strong>
</widget></code></pre>
</div>
<h3 id="the-author-element-and-its-attributes"><span class="secno">7.9 </span>The <dfn title="author element"><code title="">author</code></dfn> Element and its Attributes</h3>
<p>An <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element represents people or an organization attributed with
the creation of the widget.</p>
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Any.</dd>
<dt>Occurrences:</dt>
<dd>Zero or one.</dd>
<dt>Expected children:</dt>
<dd><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code>: zero or more.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>No. Only the first instance of this element in <a href="http://www.w3.org/TR/xpath/#dt-document-order">document order</a> will be used,
regardless of the value of <code><a href="#the-xml:lang-attribute">xml:lang</a></code> (if any).</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="author-element href"><a href="#the-href-attribute">href</a></code>, <code title="author email"><a href="#the-email-attribute">email</a></code>.</dd>
</dl><h4 id="the-href-attribute"><span class="secno">7.9.1 </span>The <code><dfn title="author-element href">href</dfn></code> Attribute</h4>
<p>An <a href="#iri-attribute">IRI attribute</a> whose value represents an IRI that the author
associates with himself or herself (e.g., a homepage, a profile on a social network,
etc.). </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="author-element href"><a href="#the-href-attribute">href</a></code> attribute with an <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element.</p>
<h4 id="the-email-attribute"><span class="secno">7.9.2 </span>The <code><dfn title="author email">email</dfn></code> Attribute</h4>
<p>A <a href="#string-attribute">string attribute</a> that represents an email address associated with the author. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="author email"><a href="#the-email-attribute">email</a></code> attribute with an <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element.</p>
<h4 id="example-of-usage-2"><span class="secno">7.9.3 </span>Example of Usage</h4>
<div class="example">
<p>The following example shows the expected usage of the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name>Café Finder</name>
<strong><author href = "http://dahut.example.org/developers/"
email = "cafefinder@example.org">
Mr. Jo and Julia Bacalhau
</author></strong>
</widget></code></pre>
</div>
<h3 id="the-license-element-and-its-attributes"><span class="secno">7.10 </span>The <dfn title="license element"><code>license</code></dfn> Element and its Attributes</h3>
<p>The <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element represents a <dfn id="software-license">software
license</dfn>, which includes, for example, a usage agreement, redistribution
statement, and/or a copyright license terms under which the content of the widget
package is provided.</p>
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Any.</dd>
<dt>Expected children:</dt>
<dd><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code>: zero or more.</dd>
<dt>Occurrences:</dt>
<dd>Zero or more (<a href="#one-element-is-allowed-per-language">one element is allowed per language</a>).</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>Yes.</dd>
<dd>
<p class="authorguide"><strong>Authoring Guidelines:</strong> The value of the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute needs to be unique for any subsequent element of this type. The content of localized <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> elements shouldn't be used to present different versions of a license, just translations of the same license.</p>
</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="license href"><a href="#the-href-attribute-0">href</a></code>. </dd>
</dl><h4 id="the-href-attribute-0"><span class="secno">7.10.1 </span>The <dfn title="license href"><code>href</code></dfn> Attribute</h4>
<p>A <a href="#valid-iri">valid IRI</a> or a <a href="#valid-path">valid path</a> that points to a
representation of a software and/or content license. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="license href"><a href="#the-href-attribute-0">href</a></code> attribute with a <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element.</p>
<h4 id="example-of-usage-3"><span class="secno">7.10.2 </span>Example of Usage</h4>
<div class="example">
<p>This example shows the expected usage of the <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element's <code title="license href"><a href="#the-href-attribute-0">href</a></code> attribute.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<strong><license href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">
Distributed under the W3C Software License.
</license></strong>
</widget></code></pre>
</div>
<div class="example">
<p>This example shows the expected usage of the <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element when the <code title="license href"><a href="#the-href-attribute-0">href</a></code> attribute is
omitted.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<strong><license>
...
</strong> <strong> 3.3.1 Widgets can use any APIs or libraries, prescribed by anyone.
Widgets a are a free and open Web technology, so can be produced for free
and sold anywhere. Widgets can be written in JavaScript
so can run on any conforming engine (without the annoying restrictions of
C, C++, or Objective-C). You can even "cross-compile" them, if you want.
...
</license></strong>
</widget></code></pre>
</div>
<h3 id="the-icon-element-and-its-attributes"><span class="secno">7.11 </span>The <dfn title="icon element"><code>icon</code></dfn> Element and its Attributes</h3>
<p>The <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element represents a <a href="#custom-icon">custom
icon</a> for the widget.</p>
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Empty.</dd>
<dt>Occurrences:</dt>
<dd>Zero or more.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>No. Relies on <a href="#folder-based-localization-0">folder-based localization</a>.</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="icon src"><a href="#the-src-attribute">src</a></code>, <code title="icon width"><a href="#the-width-attribute-0">width</a></code>, <code title="icon height"><a href="#the-height-attribute-0">height</a></code>. </dd>
</dl><h4 id="the-src-attribute"><span class="secno">7.11.1 </span>The <dfn title="icon src"><code>src</code></dfn> Attribute</h4>
<p>A <a href="#path-attribute">path attribute</a> that points to a <a href="#file">file</a> inside the
widget package. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> When an <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element is used, it is required for authors to
use the <code title="icon src"><a href="#the-src-attribute">src</a></code> attribute.</p>
<h4 id="the-width-attribute-0"><span class="secno">7.11.2 </span>The <code><dfn title="icon width">width</dfn></code> Attribute</h4>
<p>A <a href="#valid-non-negative-integer" title="valid non-negative integer">numeric attribute</a> greater than <code>0</code> that represents, in <a href="http://www.w3.org/TR/CSS21/syndata.html#length-units">CSS pixels</a> <a href="#css2">[CSS2]</a>, the author's preferred width for the icon. A user agent <em class="ct">may</em> ignore this value when changing the height icon to fit a rendering context or for accessibility reasons. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="icon width"><a href="#the-width-attribute-0">width</a></code> attribute of an <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element.</p>
<h4 id="the-height-attribute-0"><span class="secno">7.11.3 </span>The <code><dfn title="icon height">height</dfn></code> Attribute</h4>
<p>A <a href="#valid-non-negative-integer" title="valid non-negative integer">numeric attribute</a> greater than <code>0</code> that represents, in <a href="http://www.w3.org/TR/CSS21/syndata.html#length-units">CSS pixels</a> <a href="#css2">[CSS2]</a>, the author's preferred height for the icon. A user agent <em class="ct">may</em> ignore this value when changing the height icon to fit a rendering context or for accessibility reasons. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="icon height"><a href="#the-height-attribute-0">height</a></code> attribute of an <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element.</p>
<h4 id="example-of-usage-4"><span class="secno">7.11.4 </span>Example of Usage</h4>
<div class="example">
<p>This example shows the expected usage of the <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element. The example declares three icon elements, two of
which are raster and one of which is an <a href="#svgtiny">[SVGTiny]</a> file. The raster
graphics would be used for display contexts smaller than 256x256 pixels. <a href="http://www.w3.org/TR/xpath/#dt-document-order">Document order</a> of the elements is
irrelevant.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<strong><icon src="icons/medium.png"/>
<icon src="icons/big.svg" width="256" height="256"/>
<icon src="icons/tiny.png"/></strong>
</widget></code></pre>
</div>
<h3 id="the-content-element-and-its-attributes"><span class="secno">7.12 </span>The <dfn title="content element"><code>content</code></dfn> Element and its Attributes</h3>
<p>The <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element is used by an author to
declare which <a href="#custom-start-file-0">custom start file</a> the user agent is expected to use when it instantiates the widget.</p>
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Empty.</dd>
<dt>Occurrences:</dt>
<dd>Zero or one.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>No. Relies on <a href="#folder-based-localization-0">folder-based localization</a>.</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="content src"><a href="#the-src-attribute-0">src</a></code>, <code title="content type"><a href="#the-type-attribute">type</a></code>, <code title="content encoding"><a href="#the-encoding-attribute">encoding</a></code>.</dd>
</dl><h4 id="the-src-attribute-0"><span class="secno">7.12.1 </span>The <code><dfn title="content src">src</dfn></code> Attribute</h4>
<p>A <a href="#path-attribute">path attribute</a> that allows an author to point to a <a href="#file">file</a> within the <a href="#widget-package">widget package</a>. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> When a <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element is used, it is required for authors to
use the <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute.</p>
<h4 id="the-type-attribute"><span class="secno">7.12.2 </span>The <dfn title="content type"><code>type</code></dfn> Attribute</h4>
<p>A <a href="#media-type-attribute">media type attribute</a> that indicates the <a href="#media-type-0">media type</a> of
the file referenced by the <code>src</code> attribute. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors
to use the <code title="content type"><a href="#the-type-attribute">type</a></code> attribute with a <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element. When the value is absent, the
user agent will assume the value <code>text/html</code>. </p>
<h4 id="the-encoding-attribute"><span class="secno">7.12.3 </span>The <dfn title="content encoding"><code>encoding</code></dfn> Attribute</h4>
<p>A <a href="#keyword-attribute">keyword attribute</a> that denotes the character encoding of the file identified by
the <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute. The value is the "name"
or "alias" of any "Character Set" listed in <a href="#iana-charsets">[IANA-Charsets]</a>. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="content encoding"><a href="#the-encoding-attribute">encoding</a></code> attribute with a <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element. Where aliases are given by
the <a href="#iana-charsets">[IANA-Charsets]</a> registry, authors are encouraged to use the value of the
"preferred MIME name" (if any) from the registry.</p>
<p>The <dfn id="default-encoding">default encoding</dfn> is <a href="#utf-8">[UTF-8]</a>, which has the name "<code><a href="#utf-8">UTF-8</a></code>" in the <a href="#iana-charsets">[IANA-Charsets]</a> registry. </p>
<p>Aside from the <a href="#default-encoding">default encoding</a>, it is <em class="ct">optional</em> for a <a class="product-ua" href="#user-agent">user
agent</a> to <a href="#supported" title="supported">support</a> other character encodings. </p>
<h4 id="example-of-usage-5"><span class="secno">7.12.4 </span>Example of Usage</h4>
<div class="example">
<p>This example shows the expected usage of the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element:</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<strong><content src="myWidget.html"/></strong>
</widget></code></pre>
</div>
<div class="example">
<p>This example shows the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element being
used with a <code>encoding</code> attribute to override the default value of the <code>encoding</code> attribute (<code><a href="#utf-8">UTF-8</a></code>) with the GB2312 character set, which the author has
used to encode simplified Chinese characters:</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name xml:lang="zh-cn">古老瓷地图</name>
<name>Ancient Chinese Maps</name>
<strong><content src="china-maps.html" encoding="GB2312"/></strong>
</widget></code></pre>
</div>
<div class="example">
<p>This example shows the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element being
used with a <code title="content type"><a href="#the-type-attribute">type</a></code> attribute to instantiate a widget
created with a proprietary <a href="#media-type-0">media type</a>:</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name>Location-Based Games Finder</name>
<strong><content src="lbg-maps.swf" type="application/x-shockwave-flash"/></strong>
<feature name="http://example.org/api.geolocation"
required="false"/>
</widget></code></pre>
</div>
<h3 id="the-feature-element-and-its-attributes"><span class="secno">7.13 </span>The <dfn title="feature element"><code>feature</code></dfn> Element and its Attributes</h3>
<p>A <dfn id="feature">feature</dfn> is a URI identifiable runtime component (e.g. an Application Programming
Interface or video decoder). The act of a an author requesting the availability of a feature through a <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element is referred to as a <dfn id="feature-request">feature request</dfn>. The <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element serves as a standardized means to request the
binding of an IRI identifiable runtime component to a widget for use at runtime.
Using a <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element denotes that, at runtime,
a widget can attempt to access the <a href="#feature">feature</a> identified by the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element's <code title="feature name"><a href="#the-name-attribute">name</a></code> attribute. How a user agent makes use of <a href="#feature" title="feature">features</a> depends
on the user agent's security policy, hence activation and authorization requirements
for features are beyond the scope of this specification. A feature has zero or more <a href="#parameter" title="parameter">parameters</a> associated with it.</p>
<!--- p>When a <code title="feature element">feature</code> element is nested inside another feature element, it
denotes a <dfn>fallback relationship</dfn>: if the feature identified by the outermost
element is unavailable, then the user agent will check for the availability of the
feature identified by the child's element's <code title="feature name">name</code> attribute.</p -->
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Zero or more <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> elements.</dd>
<dt>Occurrences:</dt>
<dd>Zero or more.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>No.</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="feature name"><a href="#the-name-attribute">name</a></code>, <code title="feature required"><a href="#the-required-attribute">required</a></code>. </dd>
</dl><h4 id="the-name-attribute"><span class="secno">7.13.1 </span>The <dfn title="feature name"><code title="feature name">name</code></dfn> Attribute</h4>
<p>An <a href="#iri-attribute">IRI attribute</a> that identifies a <a href="#feature">feature</a> that is needed by the widget at runtime (such as an <abbr title="application programming interface">API</abbr>). </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> When the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element is declared, it is required for authors to use the <code title="feature name"><a href="#the-name-attribute">name</a></code> attribute.</p>
<h4 id="the-required-attribute"><span class="secno">7.13.2 </span>The <code><dfn title="feature required">required</dfn></code> Attribute</h4>
<p>A <a href="#boolean-attribute">boolean attribute</a> that indicates whether or not this <a href="#feature">feature</a> has to be available to the widget at runtime. </p>
<p>When set to <code>true</code>, the <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute denotes that a <a href="#feature">feature</a> is absolutely needed by the widget to function correctly, and
without the availability of this <a href="#feature">feature</a> the widget serves no useful
purpose or won't execute properly. </p>
<p>When set to <code>false</code>, the <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute denotes that a
widget can function correctly without the <a href="#feature">feature</a> being <a href="#supported">supported</a> or otherwise made available by the user agent. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute with an <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element. However, authors need to be aware that a user agent will behave as if the <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute had been set to <code>true</code> when the <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute is absent, meaning that the named <a href="#feature">feature</a> needs to be available at
runtime or the widget will be treated as an <a href="#invalid-widget-package-0">invalid widget package</a>. </p>
<h4 id="example-of-usage-6"><span class="secno">7.13.3 </span>Example of Usage</h4>
<div class="example">
<p>This example demonstrates a widget that would like to use a fictional geo-location <abbr title="application programming interface">API</abbr> feature, but would still
be able to function if the feature cannot be made available to the widget by the user
agent.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<strong><feature name = "http://example.org/api/geolocation"
required = "false"/> </strong>
</widget></code></pre>
</div>
<h3 id="the-param-element-and-its-attributes"><span class="secno">7.14 </span>The <dfn title="param element"><code>param</code></dfn> Element and its Attributes</h3>
<p>The <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element defines a <a href="#parameter">parameter</a> for a <a href="#feature">feature</a>. A <dfn id="parameter">parameter</dfn> is a name-value pair that is associated with the corresponding <a href="#feature">feature</a> for which the parameter is declared for. A author establishes the relationship between a <a href="#parameter">parameter</a> and feature by having a <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element as a
direct child of a <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element in <a href="http://www.w3.org/TR/xpath/#dt-document-order">document order</a>.</p>
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element.</dd>
<dt>Content model:</dt>
<dd>Empty.</dd>
<dt>Occurrences:</dt>
<dd>Zero or more.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>No.</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="param name"><a href="#the-name-attribute-0">name</a></code>, <code title="param value"><a href="#the-value-attribute">value</a></code>. </dd>
</dl><h4 id="the-name-attribute-0"><span class="secno">7.14.1 </span>The <code><dfn title="param name">name</dfn></code> Attribute</h4>
<p>A <a href="#string-attribute">string attribute</a> that denotes the name of this <a href="#parameter">parameter</a>. </p>
<p class="authorguide"><strong>Authoring Guideline:</strong>When a <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element is declared, it is required for authors to
use the <code title="param name"><a href="#the-name-attribute-0">name</a></code> attribute. </p>
<h4 id="the-value-attribute"><span class="secno">7.14.2 </span>The <code><dfn title="param value">value</dfn></code> Attribute</h4>
<p>A <a href="#string-attribute">string attribute</a> that denotes the value of this <a href="#parameter">parameter</a>. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> When a <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element is used, it is required for authors to
use the <code title="param value"><a href="#the-value-attribute">value</a></code> attribute.</p>
<h4 id="example-of-usage-7"><span class="secno">7.14.3 </span>Example of Usage</h4>
<div class="example">
<p>This example demonstrates a widget that makes use of a fictional geo-location
feature where by its accuracy is set to "<code>low</code>" via a <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<feature name="http://example.org/api/geolocation">
<strong><param name="accuracy" value="low"/> </strong>
</feature>
</widget></code></pre>
</div>
<h3 id="the-preference-element-and-its-attributes"><span class="secno">7.15 </span>The <code><dfn title="preference element">preference</dfn></code> Element and its Attributes</h3>
<p>The <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element allows authors to
declare one or more preferences: a <dfn id="preference">preference</dfn> is a persistently stored
name-value pair that is <a href="#associate" title="associate">associated</a> with the widget the
first time the widget is initiated.</p>
<p class="note"><span class="notetitle">Note:</span> A user agent that <a href="#supported" title="supported">supports</a> the <a href="#widgets-apis">[Widgets-APIs]</a> specification will expose any declared <a href="#preference">preference</a> at runtime in the manner described
in the <a href="#widgets-apis">[Widgets-APIs]</a> specification.</p>
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element.</dd>
<dt>Occurrences:</dt>
<dd>Zero or more.</dd>
<dt>Expected children:</dt>
<dd>none.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>No.</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>, <code title="preference name"><a href="#the-name-attribute-1">name</a></code>, <code title="preference value"><a href="#the-value-attribute-0">value</a></code>, <code title="preference readonly"><a href="#the-readonly-attribute">readonly</a></code>.</dd>
</dl><h4 id="the-name-attribute-1"><span class="secno">7.15.1 </span>The <code><dfn title="preference name">name</dfn></code> Attribute</h4>
<p>A string that denotes the name of this <a href="#preference">preference</a>. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> When a <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element is used, it is required for authors to
use the <code title="preference name"><a href="#the-name-attribute-1">name</a></code> attribute.</p>
<h4 id="the-value-attribute-0"><span class="secno">7.15.2 </span>The <code><dfn title="preference value">value</dfn></code> Attribute</h4>
<p>A string that denotes the value of this <a href="#preference">preference</a>. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="preference value"><a href="#the-value-attribute-0">value</a></code> attribute with a <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element.</p>
<h4 id="the-readonly-attribute"><span class="secno">7.15.3 </span>The <code><dfn title="preference readonly">readonly</dfn></code> Attribute</h4>
<p>A <a href="#boolean-attribute">boolean attribute</a> indicating whether this preference can, or cannot, be
overwritten at runtime (e.g., via an author script). When set to <code>true</code>, it means that the <a href="#preference">preference</a> cannot be overwritten. When set to <code>false</code>, it means that the <a href="#preference">preference</a> can be overwritten. </p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> It is optional for authors to use the <code title="readonly">readonly</code> attribute with a <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element. If the <code title="readonly">readonly</code> attribute is absent, the user agent will act as if the readonly attribute had been set to <code>false</code> (meaning that the <a href="#preference">preference</a> can be overwritten at runtime).</p>
<h4 id="example-of-usage-8"><span class="secno">7.15.4 </span>Example of Usage</h4>
<div class="example">
<p>This example shows a widget where two preferences are set. The second <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> is set as "read only" via the <code>readonly</code> attribute, which means the values of that preference cannot be changed at
runtime.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<strong><preference name = "skin"
value = "alien"/>
<!-- The preference below will be protected
from modification and deletion at runtime -->
<preference name = "api-key"
value = "f6d3a312f9d742"
readonly = "true"/></strong>
</widget></code></pre>
</div>
<h3 id="the-span-element-and-its-attributes"><span class="secno">7.16 </span>The <dfn title="span element"><code>span</code></dfn> Element and its Attributes</h3>
<p>The <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element is a wrapper for text content; on its own it serves no useful function. </p>
<p>It is expected that authors will use the <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element with the <a href="#global-attributes-0">global attributes</a>. When combined with the <code><a href="#the-dir-attribute">dir</a></code> attribute, the <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element can indicate the textual directionality of text content. In other words, it allows authors to set the base direction for the Unicode bidirectional algorithm <a href="#bidi">[BIDI]</a>. When combined with the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute, the <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element allows the author to indicate the particular language used for a subset of text content within another element. </p>
<dl><dt>Context in which this element is used:</dt>
<dd>As a child of the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code>, <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code>, <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code>, and/or <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element. </dd>
<dt>Occurrences:</dt>
<dd>Zero or more.</dd>
<dt>Expected children:</dt>
<dd>Any.</dd>
<dt>Localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code>:</dt>
<dd>
<p>No, meaning that declaring <code><a href="#the-xml:lang-attribute">xml:lang</a></code> on a <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element within a parent element (e.g., a <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element) will not affect the behavior of <a href="#element-based-localization-0">element-based localization</a> (see Example of Usage below to see how this works). </p>
</dd>
<dd>
<p class="authorguide"><strong>Authoring Guidelines:</strong> Authors are encouraged to use <code><a href="#the-xml:lang-attribute">xml:lang</a></code> to indicate the language information for text content contained within a <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element. See Example of Usage for more information. </p>
</dd>
<dt>Attributes:</dt>
<dd><a href="#global-attributes-0" title="global attributes">Global attributes</a>.</dd>
</dl><h4 id="example-of-usage-9"><span class="secno">7.16.1 </span>Example of Usage</h4>
<p><em>This section is informative.</em></p>
<div class="example">
<p>This example shows the <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> elements being used to indicate directionality of text as well as language information. Note that the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element's <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute is set to an empty string to allow it to be used as <a href="#default-content">default content</a> in the process of <a href="#element-based-localization-0">element-based localization</a>: </p>
<pre>
<code><widget
xmlns="http://www.w3.org/ns/widgets"
xml:lang="he" dir="rtl">
<name xml:lang="" dir="ltr">
<span xml:lang="en">GPS Weather!</span>
</name>
<description>
יישומון ה-
<span dir="ltr" xml:lang="en">GPS Weather!</span> מאפשר
לך לבדוק את מזג הא
וויר בכל נקודת GPS ברחבי העולם.
</description>
<description xml:lang="" dir="ltr">
<span xml:lang="en">The GPS Weather! widget lets you check
the weather at any point around the world with GPS.</span>
</description>
</widget></code></pre>
</div>
<h2 id="internationalization-and-localization"><span class="secno">8 </span>Internationalization and localization</h2>
<p><dfn id="internationalization">Internationalization</dfn>, or i18n, is the design and development of a
product, application or document content that enables localization for target
audiences that vary in culture, region, or language. <dfn id="localization">Localization</dfn> refers to
the adaptation of a product, application or document content to meet the language,
cultural and other requirements of a specific target market (a "locale").</p>
<p class="note"><span class="notetitle">Note:</span> See also the <cite><a href="http://www.w3.org/TR/2004/NOTE-ws-i18n-scenarios-20040730/#locale">Web Services
Internationalization Usage Scenarios</a></cite> and the <cite><a href="http://www.unicode.org/reports/tr35/#Locale">Unicode Locale Data Markup
Language</a></cite> for an informative discussion on the term locale.</p>
<p><dfn id="localized-content">Localized content</dfn> is content an author has explicitly <a href="#localization" title="localization">localized</a>: that is, a <a href="#widget-package">widget package</a> that contains
content localized using <a href="#folder-based-localization-0">folder-based localization</a> or a <a href="#configuration-document-0">configuration
document</a> that contains content localized via <a href="#element-based-localization-0">element-based
localization</a>.</p>
<p><dfn id="default-content">Default content</dfn> is content included in the <a href="#widget-package">widget
package</a> or in the <a href="#configuration-document-0">configuration document</a> that has not been
explicitly localized or content explicitly indicated by the author to be used as default content via the <code>defaultlocale</code> attribute of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element. In the case of a <a href="#widget-package">widget package</a>, this means content outside the <a href="#container-for-localized-content">container for localized content</a>. In the case of a <a href="#configuration-document-0">configuration document</a>,
this means any element without an explicitly declared or inherited <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute.</p>
<p>A <dfn id="localized-file">localized file</dfn> is any <a href="#file">file</a> that has been placed inside a <a href="#locale-folder-0">locale folder</a> (i.e., <a href="#localized-content">localized content</a> that makes use of <a href="#folder-based-localization-0">folder-based localization</a>). A widget
package contains zero or more localized files. All files and
folders, except for the <a href="#digital-signature" title="digital signature">digital signatures</a> and
the <a href="#configuration-document-0">configuration document</a>, can be localized via <a href="#folder-based-localization-0">folder-based localization</a>.</p>
<p class="example">For example, a locale folder "<code>locales/ja/</code>" (Japanese) might contain
an HTML document translated into Japanese.</p>
<p class="authorguide"><strong>Authoring Guidelines:</strong> <a href="#locale-folder-0" title="locale folder">Locale folders</a> need to be placed in the <a href="#container-for-localized-content">container for
localized content</a> (a locale folder not in a <a href="#container-for-localized-content">container for localized
content</a> will be treated as an <a href="#arbitrary">arbitrary</a> folder). In addition, authors making use of localization features provided by this specification should translate, localize, or alter <a href="#localized-content">localized content</a> for a the given locale, and test their widgets thoroughly.</p>
<h3 id="bidirectional-text"><span class="secno">8.1 </span>Bidirectional text</h3>
<p>In conjunction to mandating that user agents support <a href="#unicode">[Unicode]</a>, this specification provides the <code><a href="#the-dir-attribute">dir</a></code> attribute and <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element as a markup-based means of influencing the directionality for bidirectional Unicode text <a href="#bidi">[BIDI]</a>. See the definitions of the <code><a href="#the-dir-attribute">dir</a></code> attribute and <code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code> element for usage examples. </p>
<h3 id="localization-model"><span class="secno">8.2 </span>Localization Model</h3>
<p>This specification provides two means that authors can use to explicitly localize
the content of a widget:</p>
<ol><li>
<p>By placing localized file content in <a href="#locale-folder-0" title="locale folder">locale
folders</a>, a process referred to as <a href="#folder-based-localization-0">folder-based localization</a>.</p>
</li>
<li>
<p>By explicitly marking XML elements in the <a href="#configuration-document-0">configuration document</a> as
localized, a process referred to as <a href="#element-based-localization-0">element-based localization</a>.</p>
</li>
</ol><p>Both forms of localization are described below. Folder-based and element-based
localization rely on the user agent to match the language ranges held by the <var><a href="#user-agent-locales">user
agent locales</a></var> to the appropriate locale folders and/or localized XML elements in
the widget's <a href="#configuration-document-0">configuration document</a>.</p>
<h3 id="folder-based-localization"><span class="secno">8.3 </span>Folder-based localization</h3>
<p>This specification defines the concept of <dfn id="folder-based-localization-0">folder-based localization</dfn>,
which is the process whereby an author places <a href="#file" title="file">files</a> inside <a href="#folder" title="folder">folders</a> that are named in a manner that conforms to a <code>language-range</code> ABNF rule of this specification. That
is, by naming folders in lower-case using values derived from the <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Language Subtag
Registry</a> such as "<code>en-us</code>", "<code>en-gb</code>", and so on, but
avoiding subtags marked as <dfn class="external" id="deprecated">deprecated</dfn>, <dfn class="external" id="grandfathered">grandfathered</dfn>, or <dfn class="external" id="redundant">redundant</dfn> in the <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Language Subtag
Registry</a>. These <a href="#locale-folder-0" title="locale folder">locale folders</a> are then placed
inside the <a href="#container-for-localized-content">container for localized content</a>.</p>
<p class="authorguide"><strong>Authoring Guidelines</strong> Although BCP 47 recommends a particular case-folding convention, the use of upper or lowercase letters has no meaning in a language tag. Because folders inside a widget package are treated by the user-agent in a case-sensitive manner, the names of the folders inside a 'locale' folder must be all lowercase. All language tags are mapped to lowercase for matching purposes (although they can appear in any form in the configuration file or elsewhere).</p>
<p>The <dfn id="container-for-localized-content">container for localized content</dfn> is a <a href="#reserved">reserved</a> <a href="#folder">folder</a> at the <a href="#root-of-the-widget-package">root of the widget package</a> whose <code><a href="#folder-name">folder-name</a></code> case-sensitively matches the string '<code>locales</code>'. A
container for localized content contains zero or more <a href="#locale-folder-0" title="locale folder">locale folders</a>.</p>
<p>A <dfn id="locale-folder-0">locale folder</dfn> is a <a href="#folder">folder</a> whose <var><a href="#file-name-field">file name field</a></var> matches the production of <code><a href="#locale-folder">locale-folder</a></code> and is a direct descendant of the <a href="#container-for-localized-content">container for localized content</a> (e.g., "<code>/locales/en-us</code>",
"<code>/locales/fr</code>", etc). A <a href="#locale-folder-0">locale folder</a> contains zero or more <a href="#arbitrary">arbitrary</a> folders and/or files.</p>
<div class="authorguide">
<p><strong>Authoring Guidelines</strong> Authors need to avoid region, script or
other subtags except where they add useful distinguishing information to a <a href="#locale-folder-0">locale folder</a>. In addition, avoid including empty <a href="#locale-folder-0" title="locale folder">locale folders</a> in a <a href="#widget-package">widget package</a> (unless there
is a good reason to include them).</p>
<div class="example">
<p>An example of a widget that uses folder-based localization:</p>
<pre>
<code>widget.wgt
locales/zh-hans-cn/a.gif
locales/zh-hans-cn/f.gif
locales/zh-hans/a.gif
locales/zh-hans/b.gif
locales/zh/a.gif
locales/zh/b.gif
locales/zh/c.gif
a.gif
b.gif
c.gif
d.gif
index.html
config.xml</code></pre>
</div>
<p>Authors can further facilitate the localization process by grouping <a href="#file" title="file">files</a> into <a href="#folder">folder</a> hierarchies made up of matching subtags,
as is shown in the example.</p>
<p>Assuming the widget's locale is "zh-hans-cn", a reference to:</p>
<ul><li>a.gif would resolve to locales/zh-hans-cn/a.gif</li>
<li> b.gif would resolve to locales/zh-hans/b.gif</li>
<li> c.gif would resolve to locales/zh/c.gif</li>
<li> d.gif would resolve to d.gif, as it is not associated with any
locales and is hence available to all locales.</li>
</ul><p>This works at all sub-levels, so long as the parent subtag matches the child
subtags. So, for example, the "<code>cn</code>" region can make use of the localized
files in the "zh-hans" folder level, the "zh" folder level, and the unlocalized files
at the <a href="#root-of-the-widget-package">root of the widget package</a>. The user agent always prioritizes
files in sub-folders over files in locale folders closer to the <a href="#root-of-the-widget-package">root of the
widget package</a>. Conversely, if the widget's locale were "<code>en-us</code>",
references to a.gif, b.gif, c.gif and d.gif would all resolve to the files in the
root of the widget package.</p>
<p>Note also that the user agent treats any <a href="#file">file</a> or <a href="#folder">folder</a> outside the container for localized content as <a href="#default-content">default content</a>.</p>
</div>
<h3 id="element-based-localization"><span class="secno">8.4 </span>Element-Based Localization</h3>
<p>This specification defines the concept of <dfn id="element-based-localization-0">element-based localization</dfn>,
which allows authors to use the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute to explicitly indicate
that an <a href="#xml">[XML]</a> element in the <a href="#configuration-document-0">configuration document</a> has been <a href="#localization" title="localization">localized</a>.</p>
<div class="example">
<p>The following is an example of element-based localization:</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name short="Weather">
The Ultimate Weather Widget
</name>
<name short="Boletim" xml:lang="pt">
Boletim Metereológico
</name>
</widget></code></pre>
</div>
<p>Some of the elements in the widgets namespace are defined to be <dfn id="localizable-via-xml:lang">localizable via xml:lang</dfn> as part of the element's definition (with either "yes" or "no"). See, for example, the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element. When "yes", it means that an author can utilize xml:lang to achieve element-based localization either directly or indirectly through the inheritance of the value of <code><a href="#the-xml:lang-attribute">xml:lang</a></code>. How element-based localization is handled is specified in detail in <a href="#step-7-process-the-configuration-document">Step 7</a>. </p>
<p class="note"><span class="notetitle">Note:</span> The xml:lang attribute can be used on any element in order to indicate which language is used in the content and attribute values of that element. As specified in the XML Specification, its value is inherited, such that if an element has an xml:lang attribute, all of its descendants are considered to be in that language as well, unless they specify their own <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute. Note that an element can indicate that it is in no specific language by setting <code><a href="#the-xml:lang-attribute">xml:lang</a></code> to the empty string, irrespective of whether any of its ancestors has an xml:lang attribute.</p>
<div class="example">
<p>For example, if an author uses the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute on the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element, then all child elements inherit
the value xml:lang. This means that the first <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element below behaves as <code>xml:lang="en"</code> had been explicitly used.
However, in the second <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element, the
declaration of <code>xml:lang="pt"</code> overrides <code>xml:lang="en"</code> inherited from the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element. Finally, the last name element overrides xml:lang with an empty string, so that element will be treated by the user agent as <a href="#default-content">default content</a>.</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets"
xml:lang="en">
<name short="I'm in english, though not explicitly marked as such!">
<strong>Behaves as if xml:lang="en"</strong>
</name>
<name xml:lang="pt">
<strong>The declaration of xml:lang="pt" overrides
xml:lang="en" inherited from the widget element. </strong>
</name>
<name xml:lang="">
<strong>The user agent will treat this as unlocalized content.</strong>
</name>
</widget></code></pre>
</div>
<p>If an element is marked as being localizable via <code><a href="#the-xml:lang-attribute">xml:lang</a></code> with "yes",
the specification indicates that only <dfn id="one-element-is-allowed-per-language">one element is allowed per language</dfn>:</p>
<p>One element is allowed per language means that only one element of a type is
allowed to be used per language (e.g., although many <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> elements can be present in a <a href="#configuration-document-0">configuration document</a>, only one <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element will be selected by the user agent for the English language). During
processing (<a href="#step-7-process-the-configuration-document">Step 7</a>), the user agent will only
match the first element, in <a href="http://www.w3.org/TR/xpath/#dt-document-order">document order</a>, that matches a
language range in the <var><a href="#user-agent-locales">user agent locales</a></var> and <a href="#ignore">ignore</a> any
subsequent repetitions of the element that contain a matching <code><a href="#the-xml:lang-attribute">xml:lang</a></code> value (even if that element's content is different).</p>
<div class="example">
<p>For example, assume the <var><a href="#user-agent-locales">user agent locales</a></var> only contains the
following language range: "<code>en-us</code>" (English as used in the United
States). As only one instance of the <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element is allowed per language, in the
following code the user agent would match the first <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element but would <a href="#ignore">ignore</a> the
second and third <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> elements.</p>
<pre><code>
<widget xmlns="http://www.w3.org/ns/widgets">
<description xml:lang="en">
<strong>This element would be used.</strong>
</description>
<description xml:lang="en">
<strong>This element would be ignored because there is already
a description element that uses xml:lang="en".</strong>
</description>
<description>
<strong>This element is unlocalized, and would be used if the user agent's
locale does not match any localized description elements.</strong>
</description>
<description xml:lang="">
<strong> This element would be ignored because there is already an unlocalized
description element! Using xml:lang="" makes this element behave as if
it is unlocalized.</strong>
</description>
</widget></code></pre>
<p>However, if the <var><a href="#user-agent-locales">user agent locales</a></var> only contained "<code>*</code>",
or did not match any of the localized <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> elements, then the user agent would match
the third <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element above.</p>
</div>
<p>In the case whereby the author does not use an <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute,
and no element of a particular type with <code><a href="#the-xml:lang-attribute">xml:lang</a></code> matches the <var><a href="#user-agent-locales">user agent locales</a></var>, the user agent will use the
first element that is <a href="#default-content">default content</a>, in <a href="http://www.w3.org/TR/xpath/#dt-document-order">document order</a>, that matches the
element type being sought.</p>
<div class="example">
<p>For example, now assume that the <var><a href="#user-agent-locales">user agent locales</a></var> only contains the
following language range: "<code>jp</code>" (Japanese). As only one instance of the <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element is allowed per
language, in the following code the user will agent <a href="#ignore">ignore</a> the first
two <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> elements, but would match
the third (unlocalized) <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element.</p>
<pre>
<code>
<widget xmlns="http://www.w3.org/ns/widgets">
<description xml:lang="en">
<strong>This element would be ignored.</strong>
</description>
<description xml:lang="en">
<strong>This element would be ignored.</strong>
</description>
<description>
<strong>In this case, this unlocalized element would be used.</strong>
</description>
</widget></code>
</pre>
</div>
<h3 id="localization-examples"><span class="secno">8.5 </span>Localization Examples</h3>
<p><em>This section is non-normative.</em></p>
<p>This section presents three examples of how widgets can be localized. Each example
is intended to showcase how the localization algorithm is intended to work.</p>
<h4 id="simple-example"><span class="secno">8.5.1 </span>Simple Example</h4>
<div class="example">
<p class="no-toc no-num">This example shows a widget that displays the days of the
week based on the language ranges held by the <var><a href="#user-agent-locales">user agent locales</a></var>. If the
user agent is unable to match a language range to any <a href="#locale-folder-0">locale folder</a>, the
widget displays <code>/index.html</code> at the <a href="#root-of-the-widget-package">root of the widget
package</a>.</p>
<div class="code_sniplet c1">
<p><img alt="config: " height="16" src="images/config.png" width="16" />config.xml</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name>What day is it?</name>
<description>
This widget highlights the current day
of the week.
</description>
</widget> </code></pre>
<hr /><p><img alt="file: " height="16" src="images/text.png" width="16" />locale/es/index.html</p>
<pre>
<code><!doctype html>
<title>¿Qué día es?</title>
<script src="scripts/dayfinder.js"></script>
<body>
<p>Hoy es: lunes, martes, miércoles,
jueves, viernes, sábado,
domingo
</code></pre>
</div>
<ul class="dir_listing"><li class="widget_icon"> <img alt="widget file: " height="16" src="images/widget.png" width="16" /> weekdays.wgt
<ul><li class="doc_icon"><img alt="file: " height="16" src="images/text.png" width="16" /> index.html <span class="comment">/*English*/</span></li>
<li class="doc_icon"><img alt="configuration document: " height="16" src="images/config.png" width="16" /> config.xml</li>
<li class="doc_icon"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> scripts
<ul><li><img alt="script: " height="16" src="images/script.png" width="16" /> dayfinder.js</li>
</ul></li>
<li class="config_icon"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> locales
<ul><li> <img alt="folder: " height="16" src="images/folder.png" width="16" /> fr/
<ul><li class="doc_icon"><img alt="file: " height="16" src="images/text.png" width="16" /> index.html <span class="comment">/*French*/</span></li>
</ul></li>
<li> <img alt="folder: " height="16" src="images/folder.png" width="16" /> es/
<ul><li><img alt="file: " height="16" src="images/text.png" width="16" /> index.html <span class="comment">/*Spanish*/</span></li>
</ul></li>
<li> <img alt="folder: " height="16" src="images/folder.png" width="16" /> pt/
<ul><li><img alt="file: " height="16" src="images/text.png" width="16" /> index.html <span class="comment">/*Portuguese*/</span></li>
</ul><img alt="folder: " height="16" src="images/folder.png" width="16" /> fi/
<ul><li><img alt="file: " height="16" src="images/text.png" width="16" /> index.html <span class="comment">/*Finnish*/</span></li>
</ul></li>
<li> <img alt="folder: " height="16" src="images/folder.png" width="16" /> it/
<ul><li><img alt="file: " height="16" src="images/text.png" width="16" /> index.html <span class="comment">/*Italian*/</span></li>
</ul></li>
</ul></li>
</ul></li>
</ul></div>
<h4 id="complex-example"><span class="secno">8.5.2 </span>Complex Example</h4>
<div class="example">
<p>The following is an example of a localized widget with multiple localized <a href="#icon" title="icon">icons</a>, <a href="#start-file" title="start file">start files</a> and <a href="#configuration-document-0" title="configuration document">configuration documents</a>. Some relevant
things to note from the example:</p>
<ul><li>The Spanish version (<code>locales/es/</code>) has its own localized
icon.</li>
<li>The Spanish (<code>locales/es</code>) and English (<code>locales/en/</code>)
versions of the widget use the un-localized script in <code>/scripts/engine.js</code> folder.</li>
<li>On the other hand, the English-Australia (<code>en-au</code>) version uses a
localized script (<code>en-au/scripts/engine.js</code>).</li>
</ul><div class="code_sniplet c1">
<p><img alt="config: " height="16" src="images/config.png" width="16" />/config.xml</p>
<pre>
<code><widget xmlns="http://www.w3.org/ns/widgets">
<name xml:lang="ko">웃기는 고양이</name>
<content src="cats.html"/>
</widget> </code></pre>
<hr /><p><img alt="file: " height="16" src="images/text.png" width="16" />/locales/en-au/cats.html</p>
<pre>
<code><!doctype html>
<title>G'day! LOL Cats!</title>
<script src="scripts/engine.js">
...</code></pre>
<hr /><p><img alt="file: " height="16" src="images/text.png" width="16" />/locales/es/cats.html</p>
<pre>
<code><!doctype html>
<title>Gatos Graciosos!</title>
<script src="scripts/engine.js">
...</code></pre>
</div>
<ul class="dir_listing"><li class="widget_icon"> <img alt="widget file: " height="16" src="images/widget.png" width="16" /> LOLcats.wgt
<ul><li class="doc_icon"><img alt="file: " height="16" src="images/text.png" width="16" /> cats.html <span class="comment">/*written in Korean*/</span></li>
<li class="config_icon"><img alt="configuration document: " height="16" src="images/config.png" width="16" /> config.xml</li>
<li class="doc_icon"><img alt="icon: " height="16" src="images/image.png" width="16" /> icon.png <span class="comment" title="">/*default icon*/</span></li>
<li class="doc_icon"><img alt="Digital Signature: " height="16" src="images/signature.png" width="16" /> signature.xml <span class="comment">/*not
localizable*/</span></li>
<li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> scripts/
<ul><li><img alt="script: " height="16" src="images/script.png" width="16" /> engine.js <span class="comment">/*default functionality*/</span></li>
</ul></li>
<li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> locales/ <span class="comment" title="">/*container for localized content*/</span>
<ul><li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> en-au/
<ul><li><img alt="file: " height="16" src="images/text.png" width="16" /> cats.html</li>
<li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> scripts/
<ul><li><img alt="script: " height="16" src="images/script.png" width="16" /> engine.js <span class="comment">/*custom localized
functionality*/</span></li>
</ul></li>
</ul></li>
<li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> en/
<ul><li><img alt="file: " height="16" src="images/text.png" width="16" /> cats.html <span class="comment">/*international english
version*/</span></li>
</ul></li>
<li> <img alt="folder: " height="16" src="images/folder.png" width="16" /> es/
<ul><li><img alt="file: " height="16" src="images/text.png" width="16" /> cats.html <span class="comment">/*Spanish version*/</span></li>
<li><img alt="icon: " height="16" src="images/image.png" width="16" /> icon.png <span class="comment">/*localized icon*/</span></li>
</ul></li>
</ul></li>
</ul></li>
</ul></div>
<h4 id="fallback-behavior-example"><span class="secno">8.5.3 </span>Fallback Behavior Example</h4>
<div class="example">
<p>This specification allows authors to place files and folders they don't wish to
localize at the root of the widget package. At runtime, if the user agent fails to
find a file in a <a href="#locale-folder-0">locale folder</a>, it will always search at the root of the
widget package for that missing file. The purpose of this 'fallback' model is to
reduce the number of <a href="#file" title="file">files</a> that need to be created in order
to <a href="#localization" title="localization">localize</a> a <a href="#widget-package">widget package</a>.</p>
<p>The example below demonstrates how a user agent attempts to locate a file that is
absent in a localized scenario. Assume the user agent's locale is '<code>en-gb</code>' and the zip relative path being sought is "<code>images/mast.png</code>":</p>
<ol><li>
<p>Firstly, the user agent will search for a folder that matches the user agent's
locale as closely as possible for the desired file. In this case, the user
agent would attempt to locate the relative path <code>'images/mast.png</code>' in '<code>/locales/en-gb/</code>', but would fail. </p>
</li>
<li>
<p>Secondly, if the file is absent, the user agent will search for the absent file in any
other sub-folder that is in the language range of the current locale folder. So the next place the user agent would look is in the
'<code>en/</code>' folder, where it would match the zip relative path '<code>images/mast.png</code>'.</p>
</li>
<li>
<p>Lastly, if the above fails, the user agent will search for the absent file at the root
of the widget package. So, if the user agent's locale did not find the zip relative path in one of the locale folders, then '<code>images/mast.png</code>' file at the root of the widget would be matched and this <a href="#default-content">default content</a> would be used.</p>
</li>
</ol><p>Now consider the for various Chinese variants: '<code>zh-hans-cn</code>',
'<code>zh-hans</code>', and '<code>zh</code>' below. In this case, to find the
'<code>flag.png</code>' file for Mainland Chinese in simplified script
'<code>zh-hans-cn</code>', the user agent would first look in
'<code>zh-hans-cn</code>', followed by '<code>zh-hans</code>', then in
'<code>zh</code>' where the file is located.</p>
<p>To find the '<code>mast.png</code>' file, the user agent would look in
'<code>zh-hans-cn</code>', followed by '<code>zh-hans</code>', followed
'<code>zh</code>', and finally at the root of the widget package where the absent
file is actually located.</p>
<div class="code_sniplet c1">
<p><img alt="file: " height="16" src="images/text.png" width="16" />/index.html</p>
<pre>
<code><!doctype html>
<title>Patriotic Boat</title>
<script src="scripts/engine.js">
</script>
<body>
<img src="flag.png">
<img src="mast.png"></code></pre>
</div>
<ul class="dir_listing"><li class="widget_icon"> <img alt="widget file: " height="16" src="images/widget.png" width="16" /> boat.wgt
<ul><li class="doc_icon"><img alt="file: " height="16" src="images/text.png" width="16" /> index.html</li>
<li class="doc_icon"><span class="config_icon"><img alt="configuration document: " height="16" src="images/config.png" width="16" /> config.xml</span></li>
<li class="config_icon"><img alt="icon: " height="16" src="images/image.png" width="16" /> flag.png</li>
<li class="folder"><a class="folder" href="#folder"><img alt="folder: " height="16" src="images/folder.png" width="16" /></a>images/
<ul><li><img alt="icon: " height="16" src="images/image.png" width="16" /> mast.png</li>
</ul></li>
<li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> scripts/
<ul><li><img alt="script: " height="16" src="images/script.png" width="16" /> engine.js</li>
</ul></li>
<li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> locales/
<ul><li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> en-gb/
<ul><li class="folder"><img alt="folder: " height="16" src="images/folder.png" width="16" /> images
<ul><li><img alt="icon: " height="16" src="images/image.png" width="16" /> flag.png</li>
</ul></li>
</ul></li>
<li class="folder"> <img alt="folder: " height="16" src="images/folder.png" width="16" /> en/
<ul><li><img alt="folder: " height="16" src="images/folder.png" width="16" /> images
<ul><li><img alt="icon: " height="16" src="images/image.png" width="16" /> mast.png</li>
</ul></li>
</ul></li>
<li><img alt="folder: " height="16" src="images/folder.png" width="16" /> zh-hans-cn/</li>
<li><img alt="folder: " height="16" src="images/folder.png" width="16" /> zh-hans/</li>
<li> <img alt="folder: " height="16" src="images/folder.png" width="16" /> zh/
<ul><li><img alt="icon: " height="16" src="images/image.png" width="16" /> flag.png</li>
</ul></li>
</ul></li>
</ul></li>
</ul></div>
<h2 id="steps-for-processing-a-widget-package"><span class="secno">9 </span>Steps for Processing a Widget Package</h2>
<p>The <dfn id="steps-for-processing-a-widget-package-0">steps for processing a widget package</dfn> involves nine steps that a <a href="#user-agent">user agent</a> follows in sequential order, responding
accordingly if any of the steps result in an error or if the specification asks for the
user agent to skip a step. The procedures for what to do when an error is encountered
are described as part of each step; however, there are times when it will not be
possible for the user agent to recover from an error and it will be forced to treat the
widget as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
<p>In the event that a user agent encounters an <a href="#invalid-widget-package-0">invalid widget package</a> during the <a href="#steps-for-processing-a-widget-package-0">steps for processing a widget package</a>, a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> abort all processing of the <a href="#steps-for-processing-a-widget-package-0">steps for processing a
widget package</a>.</p>
<p class="note"><span class="notetitle">Note:</span>A user agent can optimize <a href="#steps-for-processing-a-widget-package-0">steps for processing a widget package</a> and associated <a href="#processing-rules-0">processing rules</a> , or perform the steps in a different order,
but the end result needs to be indistinguishable from the result that
would be obtained by following the specification.</p>
<h3 id="processing-rules"><span class="secno">9.1 </span>Processing Rules</h3>
<p>This section defines various <dfn id="processing-rules-0">processing rules</dfn>, which are algorithms used during the <a href="#steps-for-processing-a-widget-package-0">steps for processing a widget package</a>. </p>
<p>These algorithm makes use of a few special concepts defined below:</p>
<dl><dt><dfn id="text-node">Text node</dfn></dt>
<dd>
<p>Any <code>Text</code> node, including <code>CDATASection</code> nodes (any <code>Node</code> with node type <code>TEXT_NODE</code> or <code>CDATA_SECTION_NODE</code>) as defined in the <a href="#dom3core">[DOM3Core]</a> specification. For example, the worlds "hello world!" in the following <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element: <code><name>hello world!</name></code>.</p>
</dd>
<dt><dfn id="localizable-string">Localizable string</dfn> </dt>
<dd>
<p>A data structure containing a sequence of one or more strings, each having some
associated directional information and language information (if any). The purpose of an localizable string is to assist user agent in
correctly applying the Unicode <a href="#bidi">[BIDI]</a> algorithm when displaying text. </p>
</dd>
<dd class="example">
<p>For
example, the string "Internationalization <span dir="rtl">نشاط التدويل!</span> Activity." The string contains both Arabic and English that mixes left-to-right text, right-to-left
text, and a directionality-neutral punctuation mark that could not be correctly displayed
without directional information. </p>
</dd>
<dt><code><dfn id="null">null</dfn></code></dt>
<dd>
<p>A special symbol to indicate that a value has no data. For example, "let <var>x</var> be <code><a href="#null">null</a></code>" or "if <var>y</var> is empty, then return <code><a href="#null">null</a></code>".</p>
</dd>
</dl><p class="note"><span class="notetitle">Note:</span> Note: Although languages such as ECMA Script and Java support <code><a href="#null">null</a></code> as a
native value type, there are some programming languages that have no
notion of <code><a href="#null">null</a></code> or where null is problematic (e.g. C++). Implementations
in these languages need to substitute a language-specific value or symbol
which is functionally equivalent to <code><a href="#null">null</a></code>, or if no equivalent exists, to
have no value at all. For example, the value 0 may represent <code><a href="#null">null</a></code> for
the height of a widget, since the height of a widget is defined as a
non-negative integer greater than 0. In such a case, 0 could be treated
as if it were <code><a href="#null">null</a></code>. </p>
<h4 id="rule-for-verifying-a-zip-archive"><span class="secno">9.1.1 </span>Rule for Verifying a Zip Archive</h4>
<p>The <dfn id="rule-for-verifying-a-zip-archive-0">rule for verifying a zip archive</dfn> is described in this
section. The algorithm returns either true or an error.</p>
<p>This specification does not provide the technical
details of how to actually perform the checks, for which implementers need to refer to the <a href="#zip">[ZIP]</a> specification.</p>
<ol><li>
<p>If the <a href="#zip-archive-0">Zip archive</a> is <dfn class="external" id="split-into-multiple-files">split into multiple
files</dfn> or spans <dfn class="external" id="multiple-volumes">multiple volumes</dfn>, as defined in
the <a href="#zip">[ZIP]</a> specification, then return an error and terminate this algorithm.</p>
</li>
<li>
<p>If the <a href="#zip-archive-0">Zip archive</a> is encrypted, as defined in <a href="#zip">[Zip]</a>, return an error
and terminate this algorithm.</p>
</li>
<li>Otherwise, return true. </li>
</ol><h4 id="rule-for-extracting-file-data-from-a-file-entry"><span class="secno">9.1.2 </span>Rule for Extracting File Data from a File Entry</h4>
<p>The <dfn id="rule-for-extracting-file-data-from-a-file-entry-0">rule for extracting file data from a file entry</dfn> is as follows:</p>
<ol><li>
<p>Let <var>path</var> be the <a href="#zip-relative-path">zip relative path</a> that identifies the <a href="#file-entry">file entry</a> being sought. </p>
</li>
<li>
<p>Let <var><a href="#file-entry">file entry</a></var> be the file entry identified by the <var>path</var>. </p>
</li>
<li>
<p>Let <var><a href="#file">file</a></var> be the result of decompressing (or extracting) the <var><a href="#file-data">file data</a></var> from <var><a href="#file-entry">file entry</a></var> using <a href="#zip">[Zip]</a>.</p>
</li>
<li>
<p>Return <var><a href="#file">file</a></var>.</p>
</li>
</ol><p class="note"><span class="notetitle">Note:</span> For efficiency, a user agent can
extract specific <a href="#file" title="file">files</a> as they are needed for processing
rather than extracting all the <a href="#file" title="file">files</a> at once. As a security
precaution, implementations are discouraged from extracting <a href="#file-entry" title="file entry">file entries</a> from un-trusted widgets directly onto the file system.
Instead, implementations could use, for example, a virtual file system or mapping to
access files inside a <a href="#widget-package">widget package</a>.</p>
<h4 id="rule-for-finding-a-file-within-a-widget-package"><span class="secno">9.1.3 </span>Rule for Finding a File Within a Widget Package</h4>
<p>The <dfn id="rule-for-finding-a-file-within-a-widget-package-0">rule for finding a file within a widget package</dfn> is given in the
following algorithm. The algorithm returns either a <a href="#processable-file">processable file</a>, <code><a href="#null">null</a></code>, or an error. </p>
<p>For
the sake of comparison and matching, it is <em class="ct">recommended</em> that a <a class="product-ua" href="#user-agent">user agent</a> treat all <a href="#zip-relative-path" title="zip relative path">Zip relative paths</a> as <a href="#utf-8">[UTF-8]</a>. </p>
<p class="note"><span class="notetitle">Note:</span> This specification does not define
how links in documents other than the <a href="#configuration-document-0">configuration document</a> are to be
dereferenced. For handling links in other documents, such as (X)HTML, CSS, SVG, etc.,
please refer to the <a href="#widgets-uri">[Widgets-URI]</a> specification.</p>
<ol><li>
<p>Let <var>path</var> be the path to the <a href="#file-entry">file
entry</a> being sought by the user agent.</p>
</li>
<li>
<p>If <var>path</var> is not a valid path, return an error and terminate this algorithm. </p>
</li>
<li>
<p>If the <var>path</var> starts with a U+002F SOLIDUS (e.g.,
"<code>/style/master.css</code>"), then remove the first U+002F SOLIDUS from <var>path.</var></p>
</li>
<li>
<p>Let <var>path-components</var> be the result of splitting <var>path</var> at
each occurrence of a U+002F SOLIDUS character, removing that U+002F SOLIDUS
character in the process.</p>
</li>
<li>
<p> if the first item in <var>path-components</var> case-sensitively matches the string
"<code>locales</code>", then:</p>
<ol><li>
<p>If the <var>path-components</var> does not contain a second item, then return <code><a href="#null">null</a></code>.</p>
</li>
<li>
<p>If the second item in <var>path-components</var> is not a valid <code>language-range</code>, then return <code><a href="#null">null</a></code> and terminate this
algorithm.</p>
</li>
<li>
<p>Otherwise, continue.</p>
</li>
</ol></li>
<li>
<p>For each <var>lang-range</var> in the <var><a href="#user-agent-locales">user agent locales</a></var>:</p>
<ol><li>
<p>Let <var>path</var> be the concatenation of the string
"<code>locales/</code>", the <var>lang-range</var>, a U+002F SOLIDUS character,
and the <var>path</var> (e.g., <code>locales/en-us/cats.png</code>, where
"<code>en-us</code>" is the <var>lang-range</var> and "<code>cats.png</code>"
is the <var>path</var>).</p>
</li>
<li>
<p>If <var>path</var> case-sensitively matches the <var><a href="#file-name-field">file name field</a></var> of a <a href="#file-entry">file entry</a> within the <var><a href="#widget-package">widget package</a></var> that is a <a href="#folder">folder</a>, then return an error and terminate this
algorithm.</p>
</li>
<li>
<p>If <var>path</var> case-sensitively matches the <var><a href="#file-name-field">file name field</a></var> of a <a href="#file-entry">file entry</a> within the <var><a href="#widget-package">widget package</a></var> that is a <a href="#file">file</a>, let <var><a href="#file">file</a></var> be the result of applying
the <a href="#rule-for-extracting-file-data-from-a-file-entry-0">rule for extracting file data from a file entry</a> to <var>path</var>.</p>
</li>
<li>
<p>If <var title="">file</var> is a <a href="#processable-file">processable file</a>, then return <var title="">file</var> and terminate this algorithm.</p>
</li>
<li>
<p>If the <var>path</var> points to a <a href="#file-entry">file entry</a> that is not a <a href="#processable-file">processable file</a>, then return an error and terminate this
algorithm.</p>
</li>
</ol></li>
<li>
<p>If every <var>lang-range</var> in the <var><a href="#user-agent-locales">user agent locales</a></var> have been
searched, then search for a <a href="#file-entry">file entry</a> whose <var><a href="#file-name-field">file name
field</a></var> matches <var>path</var> from the <a href="#root-of-the-widget-package">root of the widget
package</a>:</p>
<ol><li>
<p>If <var>path</var> points to a <a href="#file-entry">file entry</a> within the <var><a href="#widget-package">widget package</a></var> that is a <a href="#folder">folder</a>, then return an error and terminate this
algorithm.</p>
</li>
<li>
<p>If <var>path</var> points to a <a href="#file-entry">file entry</a> within the <var><a href="#widget-package">widget package</a></var> that is a <a href="#file">file</a>, let <var><a href="#file">file</a></var> be the result of applying
the <a href="#rule-for-extracting-file-data-from-a-file-entry-0">rule for extracting file data from a file entry</a> to <var>path</var>.</p>
</li>
<li>
<p>If <var title="">file</var> is a <a href="#processable-file">processable file</a>, then return <var title="">file</var> and terminate this algorithm.</p>
</li>
<li>
<p>If the <var>path</var> points to a <a href="#file-entry">file entry</a> that is not a <a href="#processable-file">processable file</a>, then return an error and terminate this
algorithm.</p>
</li>
</ol></li>
<li>
<p>Otherwise, return <code><a href="#null">null</a></code>.</p>
</li>
</ol><h4 id="rule-for-determining-directionality"><span class="secno">9.1.4 </span>Rule for determining directionality</h4>
<p>The <dfn id="rule-for-determining-directionality-0">rule for determining directionality</dfn> is given in the following
algorithm. The algorithm always returns one of the <a href="#valid-directional-indicators">valid directional indicators</a> as a string. </p>
<ol><li>
<p>Let <var>element</var> be the element to be processed.</p>
</li>
<li>
<p>If <var>element</var> is the root element of the <a href="#configuration-document-0">configuration document</a>:</p>
<ol><li>
<p>If it does not contain a <code><a href="#the-dir-attribute">dir</a></code> attribute, return "<code><a href="#ltr">ltr</a></code>" and terminate this algorithm. </p>
</li>
<li>
<p>if it does contain a <code><a href="#the-dir-attribute">dir</a></code> attribute, and the value of the attribute case-sensitively matches one of the <a href="#valid-directional-indicators">valid directional indicators</a>, return the value of the attribute and terminate this algorithm. if the value does not case-sensitively matches one of the <a href="#valid-directional-indicators">valid directional indicators</a>, return the "<code><a href="#ltr">ltr</a></code>" and terminate this algorithm.</p>
</li>
</ol></li>
<li>
<p>If <var>element</var> does not contain a <code><a href="#the-dir-attribute">dir</a></code> attribute, recursively apply <a href="#rule-for-determining-directionality-0">rule for determining directionality</a> to the direct parent element of <var>element</var> and return the result. </p>
</li>
<li>
<p>If <var>element</var> contains a <code><a href="#the-dir-attribute">dir</a></code> attribute, let <var>direction</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a single attribute value</a> to the <var><a href="#the-dir-attribute">dir</a></var> attribute of <var>element</var>:</p>
<ol><li>
<p> If <var>direction</var> case-sensitively matches one of the <a href="#valid-directional-indicators">valid directional indicators</a>, return <var>direction</var>. </p>
</li>
<li>
<p>If <var>direction</var> did not case-sensitively match one of the <a href="#valid-directional-indicators">valid directional indicators</a>, apply the <a href="#rule-for-determining-directionality-0">rule for determining directionality</a> to the direct parent element of <var>element</var> and return the result . </p>
</li>
</ol></li>
</ol><h4 id="rule-for-getting-a-single-attribute-value"><span class="secno">9.1.5 </span>Rule for Getting a Single Attribute Value</h4>
<p>The <dfn id="rule-for-getting-a-single-attribute-value-0">rule for getting a single attribute value</dfn> is given in the following
algorithm. The algorithm always returns either a string or a <a href="#localizable-string">localizable string</a>, which can be empty. </p>
<ol><li>
<p>Let <var>attribute</var> be the attribute to be processed.</p>
</li>
<li>
<p>Let <var>value</var> be the value of the attribute to be processed.</p>
</li>
<li>
<p>In <var>value</var>, replace any sequences of <a href="#space-characters">space characters</a> (in
any order) with a single U+0020 SPACE character.</p>
</li>
<li>
<p>In <var>value</var>, remove any leading or trailing U+0020 SPACE characters.</p>
</li>
<li>
<p>If the attribute is not a <a href="#displayable-string-attribute">displayable-string attribute</a>, then let <var>result</var> be a string that contains the value of <var>value</var>. </p>
</li>
<li>
<p>Otherwise, if and only if the attribute is a <a href="#displayable-string-attribute">displayable-string attribute</a>:</p>
<ol><li>
<p>Let <var>result</var> be a <a href="#localizable-string">localizable string</a> that contains the value of <var>value</var>.</p>
</li>
<li>
<p>Let <var>element</var> be the element that owns <var>attribute</var>. </p>
</li>
<li>
<p>Let <var>direction</var> be the result of applying the <a href="#rule-for-determining-directionality-0">rule for determining directionality</a> to <var>element</var>.</p>
</li>
<li>
<p>Associate <var>direction</var> with <var>result</var>.</p>
</li>
<li>
<p> Let <var>lang</var> be the <a href="#language-tag">language tag</a> derived from having processed the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute on either <var>element</var>, or in <var>element</var>'s ancestor chain as per <a href="#xml">[XML]</a>. If <var><a href="#the-xml:lang-attribute">xml:lang</a></var> was not used anywhere in the ancestor chain, then let <var>lang</var> be an empty string. </p>
</li>
<li>
<p>Associate <var>lang</var> with <var>result</var>.</p>
</li>
</ol></li>
<li>Return <var>result</var>. </li>
</ol><h4 id="rule-for-getting-a-list-of-keywords-from-an-attribute"><span class="secno">9.1.6 </span>Rule for Getting a List of Keywords From an Attribute</h4>
<p>The <dfn id="rule-for-getting-a-list-of-keywords-from-an-attribute-0">rule for getting a list of keywords from an attribute</dfn> is given by the
following algorithm. The algorithm takes a string as input, and returns a list of strings which can be empty.</p>
<ol><li>
<p>Let <var>result</var> be the value of the attribute to be processed.</p>
</li>
<li>
<p>In <var>result</var>, replace any sequences of <a href="#space-characters">space characters</a> (in
any order) with a single U+0020 SPACE character.</p>
</li>
<li>
<p>In <var>result</var>, remove any leading or trailing U+0020 SPACE character.</p>
</li>
<li>
<p>In <var>result</var>, split the string at each occurrence of a U+0020 character,
removing that U+0020 character in the process.</p>
</li>
<li>Return <var>result.</var></li>
</ol><h4 id="rule-for-verifying-a-file-entry"><span class="secno">9.1.7 </span>Rule for Verifying a File Entry</h4>
<p>The <dfn id="rule-for-verifying-a-file-entry-0">rule for verifying a file entry</dfn> is given in the following algorithm.
The algorithm always returns a boolean value.</p>
<p>For the <a href="#file-entry">file entry</a>, check the following data in the <var><a href="#local-file-header">local file
header</a></var>.</p>
<ol><li>
<p>If the value of the <dfn id="crc-32">CRC-32</dfn> field (defined in the <a href="#zip">[ZIP]</a> specification) fails a CRC-32 check, return <code>false</code> and terminate this
algorithm.</p>
</li>
<li>
<p>The <var><a href="#file-name-field">file name field</a></var> is an empty string, return <code>false</code> and
terminate this algorithm.</p>
</li>
<li>
<p>The <var><a href="#file-name-field">file name field</a></var> contains <a href="#zip-forbidden-characters">Zip forbidden characters</a>,
return <code>false</code> and terminate this algorithm.</p>
</li>
<li>
<p>The <var><a href="#file-name-field">file name field</a></var> is a sequence exclusively composed of (one or
more) <a href="#space-characters">space characters</a> or a mixed sequence of <a href="#space-characters">space
characters</a> and U+002E FULL STOP (".") (e.g.
" . . "), return <code>false</code> and terminate this
algorithm.</p>
</li>
<li>
<p>The <var><a href="#file-name-field">file name field</a></var> is an invalid <a href="#zip-relative-path">Zip relative
path</a>, return <code>false</code> and terminate this algorithm.</p>
</li>
<li>return <code>true</code>.</li>
</ol><h4 id="rule-for-getting-text-content"><span class="secno">9.1.8 </span>Rule for Getting Text Content</h4>
<p>The <dfn id="rule-for-getting-text-content-0">rule for getting text content</dfn> is given in the following algorithm.
The algorithm always returns a <a href="#localizable-string">localizable string</a>, which can be empty.</p>
<ol><li>
<p>Let <var>input</var> be the <code>Element</code> to be processed.</p>
</li>
<li>
<p>Let <var>bidi-text</var> be an empty <a href="#localizable-string">localizable string</a>.</p>
</li>
<li>
<p>If <var>input</var> has no child nodes, return an <var>bidi-text</var> and terminate this algorithm.</p>
</li>
<li>
<p>Let <var>lang</var> be the <a href="#language-tag">language tag</a> derived from having processed the <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute on either <var>input</var>, or in <var>input</var>'s ancestor chain as per <a href="#xml">[XML]</a>. If <var><a href="#the-xml:lang-attribute">xml:lang</a></var> was not used anywhere in the ancestor chain, then let <var>lang</var> be an empty string.</p>
</li>
<li>
<p>Let <var>direction</var> be the result of applying the <a href="#rule-for-determining-directionality-0">rule for determining directionality</a> to <var>input</var>. </p>
</li>
<li>
<p>For each child node of <var>input</var>: </p>
<ol><li>
<p>If the current child node is a <a href="#text-node" title="text node">text node</a>, the associate <var>direction</var> and <var>lang</var> with the current child node. </p>
</li>
<li>
<p>If the current child node is an <code>Element</code>, recursively apply the <a href="#rule-for-getting-text-content-0">rule for getting text content</a>:</p>
<ol><li>Take all the text nodes, in order, from the returned <a href="#localizable-string">localizable string</a> and and associate them with <var>bidi-text</var>. </li>
</ol></li>
</ol></li>
<li>
<p>Associate <var>lang</var> and <var>direction</var> with bidi-text. </p>
</li>
<li>return <var>bidi-text</var>.</li>
</ol><div class="example">
<p>For example, the following configuration document: </p>
<pre><code></code><?xml version="1.0" encoding="UTF-8"?><br /><widget xmlns="http://www.w3.org/ns/widgets" dir="rtl" xml:lang="fr">
<name dir="rlo">
<span xml:lang="jp">Hello <span dir="rtl"><span dir="rlo"/>backwards</span></span>
</name>
</widget></pre>
<p>When the <a href="#rule-for-getting-text-content-0">rule for getting text content</a> is applied could be logically represented as pseudo code: </p>
<pre><code>
{dir: rlo,
lang: fr,
textNodes:
[{data: "Hello ",
direction: "rlo",
lang: "jp"},
{data: "backwards",
direction: "rtl",
lang: "jp"}]
}</code></pre>
</div>
<h4 id="rule-for-getting-text-content-with-normalized-white-space"><span class="secno">9.1.9 </span>Rule for Getting Text Content with Normalized White Space</h4>
<p class="no-toc no-num">The <dfn id="rule-for-getting-text-content-with-normalized-white-space-0">rule for getting text content with normalized white
space</dfn> is given in the following algorithm. The algorithm always returns a string,
which can be empty.</p>
<ol><li>
<p>Let <var>input</var> be the <code>Element</code> to be processed.</p>
</li>
<li>
<p>Let <var>result</var> be the result of applying the <a href="#rule-for-getting-text-content-0">rule for getting text
content</a> to <var>input</var>.</p>
</li>
<li>
<p>In <var>result</var>, convert any sequence of one or more <a href="#unicode-white-space-characters">Unicode white
space characters</a> into a single U+0020 SPACE.</p>
</li>
<li>
<p>In <var>result</var>, remove any leading or trailing U+0020 SPACE character.</p>
</li>
<li>
<p>Return <var>result</var>.</p>
</li>
</ol><div class="example">
<p>For example, the user agent would <a href="#ignore">ignore</a> the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> and <code>blink</code> elements, but their <code>Text</code> nodes would be extracted (together with directional and language information): </p>
<pre><code><widget xmlns="http://www.w3.org/ns/widgets"
xmlns:x="http://x.x.example/x" xml:lang="en">
<name>
The <blink xml:lang="en-us">Awesome</blink>
<author email="dude@example.com">Super <x:blink dir="rtl">Dude</x:blink></author>
Widget</name>
</widget></code></pre>
<p>The resulting <var><a href="#widget-name">widget name</a></var> would be "<samp>The Awesome Super
<bdo dir="rtl">Dude</bdo>
Widget</samp>" (please note that <q>Dude</q> is rendered right-to-left).</p>
</div>
<h4 id="rule-for-parsing-a-non-negative-integer"><span class="secno">9.1.10 </span>Rule for Parsing a Non-negative Integer</h4>
<p>The <dfn id="rule-for-parsing-a-non-negative-integer-0">rule for parsing a non-negative integer</dfn> is given in the following
algorithm. This algorithm returns the number zero, a positive integer, or an error.</p>
<ol><li>
<p>Let <var title="">input</var> be the string being parsed.</p>
</li>
<li>
<p>Let <var title="">result</var> have the value <code>0</code>.</p>
</li>
<li>
<p>If the length of <var title="">input</var> is <code>0</code>, return an
error.</p>
</li>
<li>
<p>Let <var title="">position</var> be a pointer into <var title="">input</var>,
initially pointing at first character of the string.</p>
</li>
<li>
<p>Let <var>nextchar</var> be the character in <var>input</var> at <var>position</var>.</p>
</li>
<li>
<p>If the <var>nextchar</var> is one of the <a href="#space-characters">space characters</a>,
increment <var title="">position</var>. If <var>position</var> is past the end of <var>input</var>, return an error and terminate this algorithm. Otherwise, go to step 5 in this algorithm.</p>
</li>
<li>
<p>If the <var>nextchar</var> is not one of U+0030 (<code>0</code>) .. U+0039
(<code>9</code>), then return <var>result</var>.</p>
</li>
<!-- Ok. At this point we know we have a number. It might have
trailing garbage which we'll ignore, but it's a number, and we
won't return an error. -->
<li>
<p>If the <var>nextchar</var> is one of U+0030 (<code>0</code>) .. U+0039
(<code>9</code>):</p>
<ol style="list-style-type:upper-alpha"><li>
<p>Multiply <var title="">result</var> by ten.</p>
</li>
<li>
<p>Add the value of the <var>nextchar</var> to <var title="">result</var>.</p>
</li>
<li>
<p>Increment <var title="">position</var>.</p>
</li>
<li>
<p>If <var title="">position</var> is not past the end of <var title="">input</var>, go to 5 in this algorithm.</p>
</li>
</ol></li>
<li>
<p>Return <var title="">result</var>.</p>
</li>
</ol><h4 id="rule-for-identifying-the-media-type-of-a-file"><span class="secno">9.1.11 </span>Rule for Identifying the Media Type of a File</h4>
<p>The <dfn id="rule-for-identifying-the-media-type-of-a-file-0">rule for identifying the media type of a file</dfn> is given by the
following algorithm. The algorithm always returns a
string.</p>
<p class="note"><span class="notetitle">Note:</span>This rule is only to be applied
when explicitly instructed to by the specification (e.g., during <a href="#step-7-process-the-configuration-document">Step 7</a>). There
are situations where alternative means are defined by the specification to identify the
media type of a file (e.g., by the presence of the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element's <code title="content type"><a href="#the-type-attribute">type</a></code> attribute or deriving the media type of a <a href="#default-start-file">default start file</a> from the <a href="#default-start-files-table">default start files table</a>).</p>
<ol><li>
<p>Let <var title="">file</var> be the <a href="#file">file</a> to be processed. </p>
</li>
<li>
<p>Let <var>content-type</var> be an empty string.</p>
</li>
<li>
<p>Let <var>extension</var> be an empty string.</p>
</li>
<li>
<p>Let <var>name</var> be the <code><a href="#file-name">file-name</a></code> component of the <a href="#zip-relative-path">zip relative path</a> that identifies the <var><a href="#file">file</a></var>.</p>
<p class="example">For example, the <var>name</var> for "<code>some/zip/rel/path/hello.png</code>" would be "<code>hello.png</code>". </p>
</li>
<li>
<p>If the first character of the <var>name</var> is a U+002E 'FULL STOP' character, and the file name contains no other U+002E 'FULL STOP' character, then go to step 10 of this algorithm. </p>
<p class="example">For example, if the name is "<samp>.htaccess</samp>", jump to step 10 and derive the media type using the <a href="#sniff">[SNIFF]</a> specification. </p>
</li>
<li>
<p>If the first character or last character of the <var>name</var> is not a U+002E 'FULL STOP' character, but <var>name</var> contains one or more U+002E 'FULL STOP' characters, then let <var>extension</var> be the sequence of characters from the last U+002E 'FULL STOP' (inclusive) to the end of <var>name</var>. </p>
<p class="example">The value of <var>extension</var> for the file name "<samp>cat.html</samp>" would be ".<samp><a href="#html">html</a></samp>". The value of extension for "...html" would be ".html". And the value of <var>extension</var> for "hello." would be an empty string. </p>
</li>
<li>
<p>If the first character of the <var>name</var> is a U+002E 'FULL STOP' character, and the file name contains another U+002E 'FULL STOP' character, then let <var>extension</var> be the sequence of characters from the last U+002E 'FULL STOP' (inclusive) to the end of <var>name</var> (if any). </p>
<p class="example">For example, if the <var>name</var> is "<samp>.myhidden.html</samp>", then the extension would be "<samp><a href="#html">.html</a></samp>".</p>
</li>
<li>
<p>If <var>extension</var> is an empty string, go to step 10 in this algorithm.</p>
</li>
<li>
<p>Check that each character in the <var> extension</var> is either in the U+0041-U+005A range or in the U+0061-U+007A range (ASCII uppercase and lowercase characters, respectively) or in the U+0030-U+0039 range (ASCII numbers 0 to 9): </p>
<ol><li>
<p>If any character in the <var>extension</var> is outside the U+0041-U+005A range or the U+0061-U+007A range or the U+0030-U+0039 range, then go to step 10 in this algorithm. </p>
<p class="example">For example, if the extension is "<samp>.pñg</samp>", the go to step 10 in this algorithm. </p>
</li>
<li>
<p> If all characters in the <var>extension</var> are in any of the U+0041-U+005A range or in the U+0061-U+007A range or the U+0030-U+0039 range (e.g., "<code>Mp3</code>"), then attempt to case-insensitive match
the value of <var>extension</var> to one of the values in the file extension column in the <a href="#file-identification-table">file identification table</a>. If there is a match, then return let <var>content-type</var> be the corresponding value from the <a href="#media-type-0">media type</a> column. </p>
</li>
<li>
<p>Go to step 11.</p>
</li>
</ol></li>
<li>
<p> Let <var>content-type</var> be the result of processing <var><a href="#file">file</a></var> through the <a href="#sniff">[SNIFF]</a> specification. </p>
</li>
<li>Return the value of <var>content-type</var>.</li>
</ol><table><caption>
<dfn id="file-identification-table">File Identification Table</dfn>
</caption>
<thead><tr><th scope="col">file extension</th>
<th scope="col">media type</th>
</tr></thead><tr><td>.html</td>
<td>text/html</td>
</tr><tr><td>.htm</td>
<td>text/html</td>
</tr><tr><td>.css</td>
<td>text/css</td>
</tr><tr><td>.js</td>
<td>application/javascript</td>
</tr><tr><td>.xml</td>
<td>application/xml</td>
</tr><tr><td>.txt</td>
<td>text/plain</td>
</tr><tr><td>.wav</td>
<td>audio/x-wav</td>
</tr><tr><td>.xhtml</td>
<td>application/xhtml+xml</td>
</tr><tr><td>.xht</td>
<td>application/xhtml+xml</td>
</tr><tr><td>.gif</td>
<td>image/gif</td>
</tr><tr><td>.png</td>
<td>image/png</td>
</tr><tr><td>.ico</td>
<td>image/vnd.microsoft.icon</td>
</tr><tr><td>.svg</td>
<td>image/svg+xml</td>
</tr><tr><td>.jpg</td>
<td>image/jpeg</td>
</tr><tr><td>.mp3</td>
<td>audio/mpeg</td>
</tr></table><p>It is <em class="ct">optional</em> for a <a class="product-ua" href="#user-agent">user agent</a> to <a href="#supported" title="supported">support</a> the <a href="#media-type-0" title="media type">media types</a> given in the <a href="#file-identification-table">file identification table</a>. </p>
<h4 id="rule-for-deriving-the-user-agent-locales"><span class="secno">9.1.12 </span>Rule for Deriving the <var><a href="#user-agent-locales">user agent locales</a></var></h4>
<p>The <dfn id="rule-for-deriving-the-user-agent-locales-0">rule for deriving the <var>user agent locales</var></dfn> is as follows: </p>
<ol><li>
<p>Let <var>unprocessed locales list</var> be a comma-separated list that contains the <a href="#system">end-user's language
ranges</a>. </p>
</li>
<li>
<p>For each <var>range</var> in the <var>unprocessed locales list</var>: </p>
<ol><li>
<p>If this <var>range</var> begins with the <a href="#subtags" title="subtags">subtag</a> '<code>*</code>' (e.g. "<code>*-us</code>" or just "<code>*</code>"), or contains any <a href="#space-characters">space characters</a>, skip
all the steps in this algorithm below, and move onto the next <var>range</var>.</p>
</li>
<li>
<p>If this <var>range</var> begins with the <a href="#subtags" title="subtags">subtag</a> "<code>i</code>" or the <var>range</var> is marked as "deprecated" in the <a href="http://www.iana.org/assignments/language-subtag-registry">IANA Language Subtag
Registry</a>, skip
all the steps in this algorithm below, and move onto the next <var>range</var>. </p>
</li>
<li>
<p>If this <var>range</var> contains any <a href="#subtags" title="subtags">subtag</a> '<code>*</code>', remove the '<code>*</code>' and its preceding hyphen
(<code>U+002F</code>) (e.g., '<code>en-*-us</code>' becomes
'<code>en-us</code>').</p>
</li>
<li>
<p>While <var>range</var> contains <a href="#subtags" title="subtags">subtags</a>:</p>
<ol style="list-style:decimal"><li>
<p>Add the value of the <var>range</var> to the <var><a href="#user-agent-locales">user agent
locales</a></var>.</p>
</li>
<li>
<p>Remove the right most <a href="#subtags" title="subtags">subtag</a> from <var>range</var> and append the resulting value to <var><a href="#user-agent-locales">user agent
locales</a></var>. Continue removing the right most <a href="#subtags" title="subtags">subtag</a> and adding the result to <var><a href="#user-agent-locales">user agent
locales</a></var> until there are no <a href="#subtags">subtags</a> left in <var>range</var>.</p>
<p class="example">For example, if the <var>range</var> was "<code>zh-hans-cn</code>",
then the <var><a href="#user-agent-locales">user agent locales</a></var> become
"<code>zh-hans-cn,zh-hans,zh</code>".</p>
</li>
<li>
<p> Move onto the next <var>range</var> and go to step 1 in this
algorithm. </p>
</li>
</ol></li>
</ol></li>
<li>
<p>Append the value "<code>*</code>" to the end of <var><a href="#user-agent-locales">user agent
locales</a></var>.</p>
</li>
</ol><p class="example">For example, an <var>unprocessed locales list</var> that contains
"<code>en-us,en-au,en,fr-ca,zh-hans-cn</code>" would result in a <var><a href="#user-agent-locales">user agent
locales</a></var> that contains
"<code>en-us,en,en-au,en,en,fr-ca,fr,zh-hans-cn,zh-hans,zh,*</code>".</p>
<p class="example">For example, an <var>unprocessed locales list</var> that contains
"<code>en-us,en,fr-ca,en,en-ca</code>" would result in a <var><a href="#user-agent-locales">user agent locales</a></var> that contains "<code>en-us,en,en,fr-ca,fr,en,en-ca,en,*</code>". </p>
<h4 id="rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive"><span class="secno">9.1.13 </span>Rule for Determining if a Potential Zip Archive is a Zip
Archive</h4>
<p>The <dfn id="rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive-0">rule for determining if a potential Zip archive is a Zip archive</dfn> is
given by the following algorithm.</p>
<ol><li>
<p>Let <var>potential archive</var> be the acquired resource.</p>
</li>
<li>
<p>Check if the first four bytes of <var>potential archive</var> match the <a href="#magic-numbers-for-a-zip-archive">magic numbers for a Zip archive</a> (<code>50 4B 03 04</code>). </p>
</li>
<li>
<p>If the first four bytes do not match the <a href="#magic-numbers-for-a-zip-archive">magic numbers for a Zip
archive</a>, then return an error.</p>
</li>
<li>
<p>Otherwise, return <code>true</code>.</p>
</li>
</ol><p class="note"><span class="notetitle">Note:</span> A user agent can inspect the <var>potential archive</var> once it has acquired the first four bytes of the <a href="#potential-zip-archive">potential Zip archive</a> or can wait until all the data of the <a href="#potential-zip-archive">potential Zip archive</a> has been completely acquired.</p>
<h3 class="no-num done" id="step-1-acquire-a-potential-zip-archive"><dfn>Step 1</dfn> - Acquire a Potential Zip Archive</h3>
<p>Step 1 involves acquiring a <a href="#potential-zip-archive">potential Zip archive</a> and confirming that
it is a <a href="#zip-archive-0">Zip archive</a> by applying the <a href="#rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive-0">rule for determining if a
potential Zip archive is a Zip archive</a>. A user agent will acquire a <a href="#potential-zip-archive">potential Zip archive</a> from a data transfer protocol that either labels
resources with a <a href="#media-type-0">media type</a> (e.g. <a href="#http">[HTTP]</a>) or from a data
transfer protocol that does not label resources with a media type (e.g., BitTorrent
or Bluetooth).</p>
<h4 id="acquisition-of-a-potential-zip-archive-labeled-with-a-media-type"><span class="secno">9.1.1 </span><dfn>Acquisition of a Potential Zip archive Labeled with a Media Type</dfn></h4>
<p id="ta-GVVIvsdEUo">It is <em class="ct">recommended</em> that a user agent <a href="#supported" title="supported">support</a> <a href="#acquisition-of-a-potential-zip-archive-labeled-with-a-media-type" title="acquisition of a potential Zip archive labeled with a media type">acquisition of a potential Zip archive from a protocol that labels resources with a media
type</a> (e.g., getting a widget package over <a href="#http">[HTTP]</a>). If a user agent <a href="#supported" title="supported">supports</a> acquisition of a potential Zip archive from a protocol that labels resources with a media
type, then the <a class="product-ua" href="#user-agent">user agent</a> needs to process resources labeled with the <a href="#valid-widget-media-type">valid widget
media type</a> (<code>application/widget</code>), regardless of whether the
resource contains a file extension or not, by applying the <a href="#rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive-0">rule for determining
if a potential Zip archive is a Zip archive</a>. During the <a href="#acquisition-of-a-potential-zip-archive-labeled-with-a-media-type">acquisition of a potential Zip archive labeled with a media
type</a>, unless the user agent <a href="#supported" title="supported">supports</a> legacy or
proprietary <a href="#media-type-0" title="media type">media types</a>, <a href="#unsupported">unsupported</a> <a href="#media-type-0" title="media type">media types</a> are in error and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat the <a href="#potential-zip-archive">potential Zip archive</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
<p id="ta-qxLSCRCHlN">If the result of the user agent applying the <a href="#rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive-0">rule for determining
if a potential Zip archive is a Zip archive</a> is <code>true</code>, meaning that the <a href="#potential-zip-archive">potential Zip archive</a> is a <a href="#zip-archive-0">Zip archive</a>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> proceed
to <a href="#step-2-verify-the-zip-archive">Step 2</a>. Otherwise, if an error is returned, the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat the <a href="#potential-zip-archive">potential Zip archive</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>. </p>
<p class="example">For example, in <a href="#http">[HTTP]</a>, where the <code>Content-Type</code> header matches <code>application/widget</code>.</p>
<p>If the protocol used for acquisition of a <a href="#potential-zip-archive">potential Zip archive</a> does
not provide, or otherwise include, a <a href="#media-type-0">media type</a>, then a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">should</em> treat the acquired <a href="#potential-zip-archive">potential Zip archive</a> as if
it has been <a href="#acquisition-of-potential-zip-archive-not-labeled-with-a-media-type" title="Acquisition of potential Zip archive not labeled with a media type">acquired from a protocol that does not label resources with a media
type</a>.</p>
<div class="example">
<p>In this example, the <a href="#media-type-0">media type</a> of the <code>Content-Type</code> is
not one <a href="#supported">supported</a> by the user agent, so the user agent would treat the <a href="#potential-zip-archive">potential Zip archive</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>:</p>
<dl><dt>Request</dt>
<dd>
<pre>
<code>GET /foo.wgt HTTP/1.1
Host: www.example.com
Accept: application/widget</code></pre>
</dd>
<dt>Response</dt>
<dd>
<pre>
<code>HTTP/1.1 200 OK
Date: Tue, 04 Sep 2007 00:00:38 GMT
Last-Modified: Mon, 03 Sep 2007 06:47:19 GMT
Content-Length: 1337
Content-Type: application/x-gadget</code></pre>
</dd>
</dl></div>
<h4 id="acquisition-of-potential-zip-archive-not-labeled-with-a-media-type"><span class="secno">9.1.2 </span><dfn>Acquisition of Potential Zip Archive not Labeled with a Media
Type</dfn></h4>
<p id="ta-FDGQBROtzW">When acquiring a potential Zip archive that has not been labeled with a media type (e.g., from a file system), a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">should</em> attempt to process
the resource regardless of the file extension (including situations when the file
extension is absent) by applying the <a href="#rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive-0">rule for determining if a potential Zip
archive is a Zip archive</a>. If the <a href="#rule-for-determining-if-a-potential-zip-archive-is-a-zip-archive-0">rule for determining if a potential Zip
archive is a Zip archive</a> return <code>true</code>, proceed to <a href="#step-2-verify-the-zip-archive">Step
2</a>. Otherwise, if an error was returned, the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat the <a href="#potential-zip-archive">potential Zip archive</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
<h3 class="no-num done" id="step-2-verify-the-zip-archive"><dfn>Step 2</dfn> - <dfn>Verify the Zip Archive</dfn></h3>
<p id="ta-uLHyIMvLwz">To verify that a <a href="#zip-archive-0">Zip archive</a> and its <a href="#file-entry" title="file entry">file
entries</a> conform to this specification, a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> apply the <a href="#rule-for-verifying-a-zip-archive-0">rule for verifying a zip archive</a>. If the <a href="#rule-for-verifying-a-zip-archive-0">rule for verifying a zip archive</a> returns <code>true</code>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> go to <a href="#step-3-set-the-configuration-defaults">Step 3</a>. Otherwise, if the <a href="#rule-for-verifying-a-zip-archive-0">rule for verifying a zip archive</a> returns an error, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat the <a href="#zip-archive-0">Zip
archive</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
<h3 class="no-num" id="step-3-set-the-configuration-defaults"><dfn>Step 3</dfn> - Set the Configuration Defaults</h3>
<p>In <a href="#step-3-set-the-configuration-defaults">Step 3</a>, a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> set the following variables and
default values as defined in the <a href="#table-of-configuration-defaults">table of configuration defaults</a>. </p>
<p class="note"><span class="notetitle">Note:</span> When a <code><a href="#null">null</a></code> value is assigned to a variable in the <a href="#table-of-configuration-defaults">table of
configuration defaults</a>, a user agent needs to treats
the value as <code><a href="#null">null</a></code> (i.e., not as an empty string and not as the text string <code><a href="#null">"null"</a></code>).</p>
<table><caption>
<dfn id="table-of-configuration-defaults">Table of Configuration Defaults</dfn>
</caption>
<thead><tr><th scope="col">Variable</th>
<th scope="col">Type</th>
<th scope="col">Overridden in</th>
<th scope="col">Description</th>
</tr><tr><th scope="row"><dfn id="author-email-var" title="author email var"><var>author email</var></dfn></th>
<td>String</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td> The value of the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element's <code title="author email"><a href="#the-email-attribute">email</a></code> attribute (if any).</td>
</tr><tr><th scope="row"><dfn id="author-href"><var>author href</var></dfn></th>
<td>IRI</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The value of the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element's <code title="author-element href"><a href="#the-href-attribute">href</a></code> attribute (if any).</td>
</tr><tr><th scope="row"><dfn id="author-name"><var>author name</var></dfn></th>
<td>String</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The text
content of the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element (if any).</td>
</tr><tr><th scope="row"><dfn id="feature-list"><var>feature list</var></dfn></th>
<td>List</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>A list of features that correspond to features that were requested via <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> elements (if any). Each item in the list corresponds to a <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element's <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> attribute, whether it is required, and any associated <a href="#parameter" title="parameter'">parameters</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="icons-0"><var>icons</var></dfn></th>
<td>List of file entries</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a>, <a href="#step-9-process-the-default-icons">Step 9</a></td>
<td>The icons of the widget as they correspond to the <a href="#default-icon" title="default icon">default icons</a> and to the occurrence of <a href="#custom-icon" title="custom icon">custom icons</a> that are <a href="#supported">supported</a> by the <a href="#widget-package">widget package</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="start-file-encoding"><var>start file encoding</var></dfn></th>
<td>String</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The character encoding of the <a href="#custom-start-file-0">custom start file</a>, corresponding
to either the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element's <code title="content encoding"><a href="#the-encoding-attribute">encoding</a></code> attribute (if any), or the <a href="#default-encoding">default encoding</a>.</td>
</tr><tr><th scope="row"><dfn id="start-file-content-type"><var>start file content-type</var></dfn></th>
<td>String</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The <a href="#media-type-0">media type</a> of the <a href="#start-file">start file</a>, corresponding to the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element's <code title="content type"><a href="#the-type-attribute">type</a></code> attribute or to a media type derived from the <a href="#default-start-files-table">default start
files table</a>.</td>
</tr><tr><th scope="row"><dfn id="widget-config-doc"><var>widget config doc</var></dfn></th>
<td><a href="#file">File</a></td>
<td><a href="#step-6-locate-the-configuration-document">Step 6</a></td>
<td>The <a href="#file">file</a> that is the <a href="#configuration-document-0">configuration document</a> for the <a href="#widget-package">widget package</a>.</td>
</tr><tr><th scope="row"><dfn id="widget-description"><var>widget description</var></dfn></th>
<td>String</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The text
content of the <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element in
the <a href="#configuration-document-0">configuration document</a>.</td>
</tr><tr><th scope="row"><dfn id="widget-height"><var>widget height</var></dfn></th>
<td>positive number</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The value of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element's <code title="widget-element height"><a href="#the-height-attribute">height</a></code> attribute in the <a href="#configuration-document-0">configuration document</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="widget-id-var" title="widget id var"><var>widget id</var></dfn></th>
<td>String</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td><p> The value of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element's <code>id</code> attribute in the <a href="#configuration-document-0">configuration document</a> (if any).</p></td>
</tr><tr><th scope="row"><dfn id="widget-license"><var>widget license</var></dfn></th>
<td>String</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The text content of the <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element in the <a href="#configuration-document-0">configuration
document</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="widget-license-file"><var>widget license file</var></dfn></th>
<td><a href="#file">File</a></td>
<td>Step 7</td>
<td>A <a href="#file">file</a> derived if the value of the <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element's <code title="license href"><a href="#the-href-attribute-0">href</a></code> is a <a href="#zip-relative-path">Zip relative path</a> to a file within the <a href="#widget-package">widget package</a>.</td>
</tr><tr><th scope="row"><dfn id="widget-license-href"><var>widget license href</var></dfn></th>
<td>IRI</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The value of the <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element's <code title="license href"><a href="#the-href-attribute-0">href</a></code> attribute in the <a href="#configuration-document-0">configuration
document</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="widget-name"><var>widget name</var></dfn></th>
<td><a href="#localizable-string">Localizable String</a></td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The text content of the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element in the <a href="#configuration-document-0">configuration
document</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="widget-preferences"><var>widget preferences</var></dfn></th>
<td>List</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td><p>The widget's <a href="#preference" title="preference">preferences</a>, corresponding to
the <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> elements in the <a href="#configuration-document-0">configuration document</a> (if any). </p>
<p>Unless an end-user explicitly requests that
these values be reverted to the values as declared in the <a href="#configuration-document-0">configuration document</a>,
a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must not</em> reset the value of the <var><a href="#widget-preferences">widget
preferences</a></var> variable on subsequent initializations of the widget.</p></td>
</tr><tr><th scope="row"><dfn id="widget-short-name"><var>widget short name</var></dfn></th>
<td><a href="#localizable-string">Localizable String</a></td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The value of the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element's <code title="name short"><a href="#the-short-attribute">short</a></code> attribute in the <a href="#configuration-document-0">configuration document</a> (if any).</td>
</tr></thead><tfoot><tr><th scope="col">Variable</th>
<th scope="col">Type</th>
<th scope="col">Overridden by</th>
<th scope="col">Description</th>
</tr></tfoot><tr><th scope="row"><dfn id="widget-version"><var>widget version</var></dfn></th>
<td><a href="#localizable-string">Localizable String</a></td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The value of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element's <code title="widget-element version"><a href="#the-version-attribute">version</a></code> attribute in the <a href="#configuration-document-0">configuration document</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="widget-width"><var>widget width</var></dfn></th>
<td>positive number</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The value of the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element's <code title="widget-element width"><a href="#the-width-attribute">width</a></code> attribute in the <a href="#configuration-document-0">configuration document</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="widget-window-modes"><var>widget window modes</var></dfn></th>
<td>List of strings</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a></td>
<td>The value of the <code title="content element"><a href="#the-content-element-and-its-attributes">widget</a></code> element's <code>viewmodes</code> attribute in the <a href="#configuration-document-0">configuration document</a> (if any).</td>
</tr><tr><th scope="row"><dfn id="widget-start-file"><var>widget start file</var></dfn></th>
<td>File entry</td>
<td><a href="#step-7-process-the-configuration-document">Step 7</a>, <a href="#step-8-locate-the-start-file">Step 8</a></td>
<td>The <a href="#start-file">start file</a> for the <a href="#widget-package">widget package</a>, corresponding
to either one of the <a href="#default-start-files-table">default start files table</a> or the <a href="#file">file</a> identified by the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element's <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute.</td>
</tr><tr><th scope="row"><dfn id="user-agent-locales"><var>user agent locales</var></dfn></th>
<td><p>List of strings</p></td>
<td><a href="#step-5-derive-the-user-agent-s-locales">Step 5</a></td>
<td>A list of <a href="#language-tag" title="language tag">language tags</a>. </td>
</tr></table><h3 class="no-num done" id="step-4-locate-and-process-the-digital-signature"><dfn>Step 4</dfn> - Locate and Process the Digital Signature</h3>
<p>If the
user agent does not <a href="#supported" title="supported">support</a> <a href="#widgets-digsig">[Widgets-DigSig]</a>, then the user agent <em class="ct">must</em> skip <a href="#step-4-locate-and-process-the-digital-signature">Step 4</a> and go to <a href="#step-5-derive-the-user-agent-s-locales">Step 5</a>. Otherwise, the user agent <em class="ct">must</em> apply the algorithm to locate digital signatures, which is defined in the <a href="#widgets-digsig">[Widgets-DigSig]</a> specification under the section named <a href="http://www.w3.org/TR/widgets-digsig/#locating-signature-files-in-a-widget-package">Locating and
Processing Digital Signatures</a>.</p>
<h3 class="no-num" id="step-5-derive-the-user-agent-s-locales"><dfn>Step 5</dfn> - Derive the User Agent's Locales</h3>
<p>The <dfn id="system">end-user's language ranges</dfn> represents the end-user's
preferred languages and regional settings, which are derived from the operating
system or directly from the user agent. As there are numerous ways a user agent can
derive the end-user's preferred languages and regional settings, the means by which
those values are derived are beyond the scope of this specification and left up to
the implementation.</p>
<p>During the <a href="#rule-for-deriving-the-user-agent-locales-0">rule for deriving the <var>user agent locales</var></a> defined below, the user agent will need to construct a list <var>unprocessed locales</var>. Each item in the <var>unprocessed locales</var> is a string in lowercase form, that conforms to the production of a <code>Language-Tag</code>, as defined in the <a href="#bcp47">[BCP47]</a> specification. A
string that conforms to the production of a <code>Language-Tag</code> is referred to
as a <dfn class="external" id="language-range">language range</dfn> <a href="#bcp47">[BCP47]</a> (e.g.
'<code>en-au</code>', which is the range of English as spoken in Australia, and
'<code>fr-ca</code>', which is the range of French as spoken in Canada, etc.). A
language range is composed of one or more <dfn id="subtags">subtags</dfn> that are delimited by a
U+002D HYPHEN-MINUS ("<code>-</code>").</p>
<p>The first item of the <var>unprocessed locales</var> represents the user's most
preferred language range (i.e., the language/region combination the user agent
assumes the end-user most wants to see content in), followed by the next most
preferred language range, and so forth.</p>
<p class="example">For example, in an <var>unprocessed locales list</var> that
contains '<code>en-us,en,fr,es</code>', English as spoken in the United States is
preferred over English, and English is preferred over French, and French is preferred
over Spanish, and Spanish is preferred over <a href="#default-content">default content</a>.</p>
<p class="example">For example, the end-user may have specified her preferred
languages and regional settings at install time by selecting a preferred language, or
languages from a list, or a list of preferred languages and regional settings could
have been dynamically derived from the end-user's geographical location, etc. </p>
<p>In <a href="#step-5-derive-the-user-agent-s-locales">Step 5</a>, the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> apply the <a href="#rule-for-deriving-the-user-agent-locales-0">rule for deriving the <var>user agent locales</var></a>.</p>
<h3 class="no-num done" id="step-6-locate-the-configuration-document"><dfn>Step 6</dfn> - Locate the Configuration Document</h3>
<p>This step involves searching within the Zip archive for a <a href="#configuration-document-0">configuration
document</a>.</p>
<p id="ta-ZjcdAxFMSx">In <a href="#step-6-locate-the-configuration-document">Step 6</a>, a <a class="product-ua" href="#user-agent">user agent</a><em class="ct"> must</em> apply the algorithm to <a href="#locate-the-configuration-document">locate the configuration document</a>.</p>
<p>The algorithm to <dfn id="locate-the-configuration-document">locate the configuration document</dfn> is as follows: </p>
<ol><li>
<p>Search at the <a href="#root-of-the-widget-package">root of the widget package</a> for a <a href="#file-entry">file
entry</a> whose <var><a href="#file-name-field">file name field</a></var> case-sensitively matches the <a href="#valid-configuration-document-file-name">valid configuration document file name</a> (<code>config.xml</code>). </p>
</li>
<li>If a
match is made, then let <var><a href="#widget-config-doc">widget config doc</a></var> to the result of applying <a href="#rule-for-extracting-file-data-from-a-file-entry-0">rule for extracting file data from a file entry</a> to the matching <a href="#file-entry">file entry</a>. If no match is made (meaning that <var><a href="#widget-config-doc">widget config doc</a></var> is <code><a href="#null">null</a></code>), then treat the <a href="#zip-archive-0">Zip
archive</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>.</li>
</ol><h3 class="no-num" id="step-7-process-the-configuration-document"><dfn>Step 7</dfn> - <dfn>Process the Configuration
Document</dfn></h3>
<p>The purpose of processing the <a href="#configuration-document-0">configuration document</a> is to override the values in the <a href="#table-of-configuration-defaults">table of configuration defaults</a>, which are used during <a href="#initialization">initialization</a> and at runtime, and to select the appropriate localized
content (if any) to be presented to the end user.</p>
<p>In conjunction to the algorithm for processing a <a href="#configuration-document-0">configuration document</a> given below, this section firstly defines some terminology used by the processing algorithm
and describes how localized elements are processed.</p>
<p>During <a href="#step-7-process-the-configuration-document">Step 7</a>, a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> apply the <a href="#algorithm-to-process-a-configuration-document-0">algorithm to process a configuration document</a>.</p>
<h4 id="terminology-used-in-processing-algorithm"><span class="secno">9.1.1 </span>Terminology Used in Processing Algorithm</h4>
<p>In the <a href="#algorithm-to-process-a-configuration-document-0">algorithm to process a configuration document</a>, the term <dfn id="in-error">in error</dfn> is used to mean that an element, or
attribute, or <a href="#file">file</a> in a <a href="#configuration-document-0">configuration document</a> is
non-conforming to the rules of this specification. How an element or an attribute is to
be treated when it is in error is always given when the term is used; but will
generally require the user agent to <a href="#ignore">ignore</a> any element, attribute, or <a href="#file">file</a> that is in error.</p>
<p> To <dfn id="ignore">ignore</dfn> means to act as if the element, attribute, or file that is <a href="#in-error">in error</a> is
absent (i.e., not declared or included by the author) in the widget package or configuration document. A user agent <em class="ct">must</em>, however, keep a record of all element types it has attempted to process even if they were ignored (this is to determine if the user agent has attempted to process an element of a given type already). </p>
<p>In the case the user agent is asked to <a href="#ignore">ignore</a> an <a href="#xml">[XML]</a> element or node, a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> :</p>
<ol><li>
<p>Stop processing the current <var>element</var>, <a href="#ignore" title="ignore">ignoring</a> all of the <var>element</var>'s attributes and child nodes (if any), and proceed to the next <var>element</var> in the <var>elements list</var>.</p>
</li>
<li>
<p>Make a record that it has attempted to process an element of that type.</p>
</li>
</ol><div class="example">
<p>In the following example, the user agent ignores both <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> elements. The user agent ignores the first because it lacks a <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute. The user agent ignores the second because it is not the first content element to be encountered by the user agent. </p>
<pre><code><widget xmlns="http://www.w3.org/ns/widgets">
<!-- User agent ignores the first, but records
that it has attempted to process a content element
-->
<content/>
<!-- The use agent knows that it has previously attempted
to process a content element, hence this content element
is ignored.
-->
<content src="cats.html"/>
</widget> </code></pre>
</div>
<p>To <dfn id="associate">associate</dfn> means that two or more pieces of information are bound and
stored together for the purpose of later processing (e.g., the name of a <a href="#feature">feature</a>, and if it is <code title="feature required"><a href="#the-required-attribute">required</a></code>, and any associated <a href="#parameter" title="parameter">parameters</a>). How associated data is represented is left
up-to the implementation (e.g., a user agent could use an array, an object, a hash map,
etc.).</p>
<p>The <dfn class="external" id="lookup">lookup</dfn> algorithm is defined in <a href="#bcp47">[BCP47]</a> (see <a href="http://tools.ietf.org/rfc/rfc5646.txt">RFC 5646</a>). It is used in this Step to
match <a href="#localized-content">localized content</a> in the <a href="#configuration-document-0">configuration document</a> to the
language ranges held by the <var><a href="#user-agent-locales">user agent locales</a></var> (if any).</p>
<h4 id="algorithm-to-process-a-configuration-document"><span class="secno">9.1.2 </span>Algorithm to Process a Configuration Document</h4>
<p>The <dfn id="algorithm-to-process-a-configuration-document-0">algorithm to process a configuration document</dfn> is as follows:</p>
<ol><li>
<p>Let <var>doc</var> be the result of loading the <var><a href="#widget-config-doc">widget config doc</a></var> as
a <a href="#dom3core">[DOM3Core]</a> <code>Document</code> using an <a href="#xml">[XML]</a> parser that is both <a href="#xmlns">[XMLNS]</a>-aware and <code><a href="#the-xml:lang-attribute">xml:lang</a></code> aware. </p>
</li>
<li>
<p id="ta-klLDaEgJeU">If <var>doc</var> is not namespace well-formed <a href="#xml">[XML]</a>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> terminate this
algorithm and treat this <a href="#widget-package">widget package</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
</li>
<li>
<p>Let <var>root element</var> be the <code>documentElement</code> of <var>doc</var>.</p>
</li>
<li>
<p id="ta-ACCJfDGwDQ">If the <var>root element</var> is not a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element in the <a href="#widget-namespace">widget namespace</a>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> terminate this
algorithm and treat this <a href="#widget-package">widget package</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
</li>
<li>
<p>Otherwise, the <var>element</var> is a <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element:</p>
<ol><li>
<p>If the <code>defaultlocale</code> attribute is used, then let <var> default locale </var> be the result of
applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a single attribute value</a> to the <code>defaultlocale</code> attribute:</p>
<ol><li>
<p id="ta-defaultlocale-ignore">If the<var> default locale </var>is <a href="#in-error">in error</a> or an empty string or already contained by the <var><a href="#user-agent-locales">user agent locales</a></var> list, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the <code>defaultlocale</code> attribute. </p>
</li>
<li>
<p id="ta-defaultlocale-process">If <var>potential default locale </var> is a <a href="#valid-language-tag">valid language tag</a> and the <var><a href="#user-agent-locales">user agent locales</a></var> does not contain the value of <var> default locale</var>, the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> prepend the value of <var> potential default locale </var>into the the <var><a href="#user-agent-locales">user agent locales</a></var> list as the second-last item (i.e., at position length - 1). </p>
<div class="example">
<p> For example,
if the <var> default locale </var>is the value "<code>fr</code>", and the <var><a href="#user-agent-locales">user agent locales</a></var> contains the values "<code>jp,us,*</code>", then the <var><a href="#user-agent-locales">user agent locales</a></var> list becomes "<code>jp,us,fr,*</code>". </p>
<p> For example,
if the <var> default locale </var>is the value "<code>en</code>", and the <var><a href="#user-agent-locales">user agent locales</a></var> only contains the value "<code>*</code>", then the <var><a href="#user-agent-locales">user agent locales</a></var> list becomes "<code>en,*</code>". </p>
<p> For example,
if the <var> default locale </var>is the value "<code>en</code>", and the <var><a href="#user-agent-locales">user agent locales</a></var> already contains the values "<code>en,*</code>", then the user agent would ignore the <var> default locale </var>because it is already contained by the <var><a href="#user-agent-locales">user agent locales</a></var> list. </p>
</div>
</li>
</ol></li>
<li>
<p id="ta-RawAIWHoMs">If the <code>id</code> attribute is used, then let <var>id</var> be the result of
applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a single attribute value</a> to the <code>id</code> attribute. If <var>id</var> is a <a href="#valid-iri">valid IRI</a>, then
let <var title="widget id var"><a href="#widget-id-var">widget id</a></var> be the value of the <var>id</var>. If the <var>id</var> is <a href="#in-error">in error</a>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the attribute.</p>
</li>
<li>
<p id="ta-VerEfVGeTc">If the <code>version</code> attribute is used, then let <var> version value</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a single
attribute value</a> to the <code>version</code> attribute. If the <var>version</var> is an empty string, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the attribute; otherwise, let <var><a href="#widget-version">widget version</a></var> be the value of <var>version value</var>.</p>
</li>
<li>
<p id="ta-BxjoiWHaMr">If the <code>height</code> attribute is used, then let <var>normalized
height</var> be the result of applying the <a href="#rule-for-parsing-a-non-negative-integer-0">rule for parsing a
non-negative integer</a> to the value of the attribute. If the <var>normalized height</var> is not <a href="#in-error">in error</a> and greater than <code>0</code>, then let <var><a href="#widget-height">widget height</a></var> be the value of <var>normalized
height</var>. If the <code>height</code> attribute is <a href="#in-error">in error</a>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the attribute.</p>
</li>
<li>
<p id="ta-UScJfQHPPy">If the <code>width</code> attribute is used, then let <var>normalized
width</var> be the result of applying the <a href="#rule-for-parsing-a-non-negative-integer-0">rule for parsing a non-negative
integer</a> to the value of the attribute. If the <var>normalized
width</var> is not <a href="#in-error">in error</a> and greater than <code>0</code>, then let <var><a href="#widget-width">widget width</a></var> be the value of <var>normalized width</var>. If the <code>width</code> attribute is <a href="#in-error">in error</a>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the attribute.</p>
</li>
<li>
<p id="ta-viewmodes">If the <code>viewmodes</code> attribute is used, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> let <var>viewmodes
list</var> be the result of applying the <a href="#rule-for-getting-a-list-of-keywords-from-an-attribute-0">rule for getting a list of
keywords from an attribute</a>:</p>
<ol><li>
<p>From the <var>viewmode list</var>, remove
any <a href="#unsupported">unsupported</a> items. </p>
</li>
<li>
<p>From the <var>viewmode list</var>, remove
any duplicated items from right to left.</p>
<p class="example">For example, <var>viewmode list</var> with a value of "<code>windowed fullscreen windowed floating fullscreen windowed</code>" would become "<code>windowed fullscreen floating</code>".</p>
</li>
<li>
<p>Let <var><a href="#widget-window-modes">widget window
modes</a></var> be the value of <var>viewmodes list</var>.</p>
</li>
</ol></li>
</ol></li>
<li>
<p id="ta-MFcsScFEaC">If the <code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code> element does not contain
any child elements, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> terminate this
algorithm and go to <a href="#step-8-locate-the-start-file">Step
8</a>.</p>
</li>
<li>
<p>Otherwise, let <dfn id="element-list"><var>element list</var></dfn> be an empty list. </p>
</li>
<li>
<p>For each <var>range</var> in the <var><a href="#user-agent-locales">user agent locales</a></var>, starting from
the first and moving to the last:</p>
<ol><li>
<p>If the value of <var>range</var> is not "*", then retaining <a href="http://www.w3.org/TR/xpath/#dt-document-order">document order</a>, let <var>matching elements</var> be the result of applying <a href="#lookup">lookup</a> to the child elements that are defined as being <a href="#localizable-via-xml:lang">localizable via <code>xml:lang</code></a> that are direct descendents of the <var>root
element</var> and whose <code><a href="#the-xml:lang-attribute">xml:lang</a></code> attribute matches the current <var>range</var>. Append <var>matching elements</var> to the <var><a href="#element-list">element list</a></var>.</p>
<p class="note"><span class="notetitle">Note:</span> In the context of this specification, the above conformance requirement is intended to match the <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code>, <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code>, and <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> elements. However, it is written in an abstract manner to provide a hook for future specifications that want to define elements that also support being <a href="#localizable-via-xml:lang">localizable via xml:lang</a>.</p>
</li>
<li>If the value of range is "*", retaining <a href="http://www.w3.org/TR/xpath/#dt-document-order">document order</a>, let <var>unlocalized elements</var> be all child elements that are direct
descendents of the <var>root element</var> that do not have an implicit or explicit <var><a href="#the-xml:lang-attribute">xml:lang</a></var> attribute (i.e., match <a href="#default-content">default content</a>). Append <var>unlocalized elements</var> to the <var><a href="#element-list">element list</a></var>.
<div class="example">
<p>For example, consider the following configuration document.</p>
<pre><code><widget xmlns="http://www.w3.org/ns/widgets">
<name>El Widget!</name>
<name xml:lang="fr">Le Widget</name>
<name xml:lang="en">The Widget</name>
</widget> </code></pre>
<p>For a use agent whose <var><a href="#user-agent-locales">user agent locales</a></var> contains "<code>en,fr,*</code>", the <var>matching elements</var> would be in the following order: </p>
<ol><li><code><name xml:lang="en">The Widget</name></code></li>
<li><code><name xml:lang="fr">Le Widget</name></code></li>
<li><code><name>El Widget!</name></code></li>
</ol><p>For a use agent whose <var><a href="#user-agent-locales">user agent locales</a></var> contains "<code>en,*</code>", the <var>matching elements</var> would be in the following order: </p>
<ol><li><code><name xml:lang="en">The Widget</name></code></li>
<li><code><name>El Widget!</name></code></li>
</ol><p>For a use agent whose <var><a href="#user-agent-locales">user agent locales</a></var> contains "<code>jp,*</code>", the <var>matching elements</var> would be in the following order: </p>
<ol><li><code><name>El Widget!</name></code></li>
</ol></div>
</li>
</ol></li>
<li>
<p>For each <var>element</var> in the <var>elements list</var>, if the <var>element</var> is one of the following:</p>
<dl class="procedure"><dt>A <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element:</dt>
<dd>
<p id="ta-LYLMhryBBT">If this is not the first <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element encountered by the user agent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>. </p>
</dd>
<dd>
<p id="ta-AYLMhryBnD">If this is the first <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element encountered by the user agent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em>:</p>
<ol><li>
<p>Record that an attempt has been made by the user agent to process a <code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code> element.</p>
</li>
<li>
<p>Let <var><a href="#widget-name">widget name</a></var> be the result of applying the <a href="#rule-for-getting-text-content-with-normalized-white-space-0">rule for
getting text content with normalized white space</a> to this
element.</p>
</li>
<li>
<p>If the <code title="name short"><a href="#the-short-attribute">short</a></code> attribute is used, then let <var><a href="#widget-short-name">widget short
name</a></var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a single
attribute value</a> to the <code title="name short"><a href="#the-short-attribute">short</a></code> attribute.</p>
</li>
</ol></dd>
<dt>A <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element:</dt>
<dd>
<p id="ta-UEMbyHERkI">If this is not the first <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element encountered by the user agent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</dd>
<dd>
<p id="ta-VdCEyDVSA">If this is the first <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element encountered by the user agent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em>: </p>
<ol><li>
<p>Record that an attempt has been made by the user agent to process a <code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code> element. </p>
</li>
<li>
<p>let <var><a href="#widget-description">widget description</a></var> be the result of applying the <a href="#rule-for-getting-text-content-0">rule for getting text content</a> to this element.</p>
</li>
</ol></dd>
<dt>A <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element:</dt>
<dd>
<p id="ta-vcYJAPVEym">If this is not the first <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element encountered by the user agent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</dd>
<dd>
<p id="ta-YUMJAPVEgI">If this is the first <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element
used, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em>:</p>
<ol><li>
<p> Record that an attempt has been made by the user agent to process a <code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code> element. </p>
</li>
<li>
<p>Let <var>license text</var> be the result of applying the <a href="#rule-for-getting-text-content-0">rule for
getting text content</a> to this element. <a href="#associate">Associate</a> <var>license text</var> with <var><a href="#widget-license">widget license</a></var>. </p>
</li>
<li>
<p>If the <code title="license href"><a href="#the-href-attribute-0">href</a></code> attribute is used, then let <var>potential license href</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a
single attribute value</a> to the <code title="license href"><a href="#the-href-attribute-0">href</a></code> attribute.</p>
</li>
<li>
<p> If <var>potential license href</var> is not a <a href="#valid-iri">valid IRI</a> or a <a href="#valid-path">valid
path</a>, then the <code title="license href"><a href="#the-href-attribute-0">href</a></code> attribute is <a href="#in-error">in error</a> and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the attribute. </p>
</li>
<li>
<p>If <var>potential license href</var> is a <a href="#valid-iri">valid IRI</a>, then let <var><a href="#widget-license-href">widget license href</a></var> be the value of <var>potential license href</var>. </p>
</li>
<li>
<p>If <var><a href="#the-href-attribute-0">license href</a></var> is a <a href="#valid-path">valid path</a>, then let <var title=""> file</var> be the result of applying the <a href="#rule-for-finding-a-file-within-a-widget-package-0">rule for
finding a file within a widget package</a> to <var><a href="#the-href-attribute-0">license href</a></var>. </p>
</li>
<li>
<p>If <var title="">file</var> is not a <a href="#processable-file">processable file</a>,
as determined by applying the <a href="#rule-for-identifying-the-media-type-of-a-file-0">rule for identifying the media type of a
file</a>, then <a href="#ignore">ignore</a> this <var>element</var>. </p>
</li>
<li>
<p>Otherwise, let <var title="">widget license</var> <var><a href="#file">file</a></var> be the value of <var><a href="#file">file</a></var>. </p>
</li>
</ol></dd>
<dt>An <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element:</dt>
<dd>
<p id="ta-iipTwNshRg">If the <code title="icon src"><a href="#the-src-attribute">src</a></code> attribute of this <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element is absent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</dd>
<dd>
<p id="ta-roCaKRxZhS">Let <var>path</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a
single attribute value</a> to the <code title="icon src"><a href="#the-src-attribute">src</a></code> attribute of this <code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code> element. If path is
not a <a href="#valid-path">valid path</a> or is an empty string, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>. </p>
</dd>
<dd>
<p id="ta-iuJHnskSHq">Let <var title="">file</var> be the result of applying the <a href="#rule-for-finding-a-file-within-a-widget-package-0">rule for
finding a file within a widget package</a> to <var>path</var>. If <var title="">file</var> is not a <a href="#processable-file">processable file</a>, as
determined by applying the <a href="#rule-for-identifying-the-media-type-of-a-file-0">rule for identifying the media type of a
file</a>, or already exists in the <var><a href="#icons-0">icons</a></var> list, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this element. </p>
</dd>
<dd>
<p>Otherwise,</p>
<ol><li>
<p id="ta-eHUaPbgfKg">If the <code title="icon height"><a href="#the-height-attribute-0">height</a></code> attribute is used, then let <var>potential <code>height</code></var> be the result of applying the <a href="#rule-for-parsing-a-non-negative-integer-0">rule for parsing a non-negative integer</a> to the attribute's
value. If the <var>potential <code>height</code></var> is not <a href="#in-error">in
error</a> and greater than <code>0</code>, then <a href="#associate">associate</a> the <var>potential <code>height</code></var> with <var title="">file</var>.
Otherwise, the <code title="icon height"><a href="#the-height-attribute-0">height</a></code> attribute is <a href="#in-error">in error</a> and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the attribute.</p>
</li>
<li>
<p id="ta-nYAcofihvj">If the <code title="icon width"><a href="#the-width-attribute-0">width</a></code> attribute is used, then let <var>potential width</var> be the result of applying the <a href="#rule-for-parsing-a-non-negative-integer-0">rule for
parsing a non-negative integer</a> to the attribute's value. If the <var>potential width</var> is not <a href="#in-error">in error</a> and greater than <code>0</code>, then <a href="#associate">associate</a> the <var>potential width</var> with <var title="">file</var>. Otherwise, the <code title="icon width"><a href="#the-width-attribute-0">width</a></code> attribute is <a href="#in-error">in
error</a> and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the attribute.</p>
</li>
<li>
<p>Add <var title="">file</var> and any <a href="#associate" title="associate">associated</a> <var>potential width</var> and/or <var>potential height</var> to the list of <var><a href="#icons-0">icons</a></var>.</p>
</li>
</ol></dd>
<dt>An <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element:</dt>
<dd>
<p id="ta-sdwhMozwIc">If this is not the first <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element encountered by the user agent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</dd>
<dd>
<p id="ta-argMozRiC">If this is the first <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element
used, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em>: </p>
<ol><li>
<p> Record that an attempt has been made by the user agent to process a <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element. </p>
</li>
<li>
<p>If the <code title="author-element href"><a href="#the-href-attribute">href</a></code> attribute is used,
then let <var>href-value</var> be the value of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for
getting a single attribute value</a> to the <code title="author-element href"><a href="#the-href-attribute">href</a></code> attribute.</p>
</li>
<li>
<p>If <var>href-value</var> is a <a href="#valid-iri">valid IRI</a>, then let <var><a href="#author-href">author href</a></var> be the value of the <code title="author-element href"><a href="#the-href-attribute">href</a></code> attribute. Otherwise, if <var>href-value</var> is not a <a href="#valid-iri">valid IRI</a>, then <a href="#ignore">ignore</a> the <code title="author-element href"><a href="#the-href-attribute">href</a></code> attribute.</p>
</li>
<li>
<p>If the <code title="author email"><a href="#the-email-attribute">email</a></code> attribute is used, then let <var title="author email var"><a href="#author-email-var">author
email</a></var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a single attribute value</a> to the <code title="author email"><a href="#the-email-attribute">email</a></code> attribute.</p>
</li>
<li>
<p>Let <var><a href="#author-name">author name</a></var> be the result of applying the <a href="#rule-for-getting-text-content-with-normalized-white-space-0">rule for
getting text content with normalized white space</a> to this
element.</p>
</li>
</ol></dd>
<dt>A <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element:</dt>
<dd>
<p id="ta-DwhJBIJRQN">If a <code title="preference value"><a href="#the-value-attribute-0">value</a></code> attribute of the <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element is used, but the <code title="preference name"><a href="#the-name-attribute-1">name</a></code> attribute is absent, then this <code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code> element is <a href="#in-error">in error</a> and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>. Otherwise, the user agent <em class="ct">must</em>: </p>
</dd>
<dd>
<ol><li>
<p>Let <var>name</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule
for getting a single attribute value</a> to the <code title="preference name"><a href="#the-name-attribute-1">name</a></code> attribute.</p>
</li>
<li>
<p>If the <var>name</var> is an empty string, then this <var>element</var> is <a href="#in-error">in error</a>; <a href="#ignore">ignore</a> this <var>element</var>. </p>
</li>
<li>
<p>If <var><a href="#widget-preferences">widget preferences</a></var> already contains a preference whose name case-sensitively matches the value of <var>name</var>, then this <var>element</var> is <a href="#in-error">in error</a>; <a href="#ignore">ignore</a> this <var>element</var>. </p>
</li>
<li>
<p>If <var>name</var> was not <a href="#in-error">in error</a>, let <var><a href="#preference">preference</a></var> be an empty object.</p>
</li>
<li>
<p>Associate <var>name</var> with <var><a href="#preference">preference</a></var>. </p>
</li>
<li>
<p>Let <var>value</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule
for getting a single attribute value</a> to the <code title="preference value"><a href="#the-value-attribute-0">value</a></code> attribute.</p>
</li>
<li>
<p><a href="#associate">Associate</a> <var>value</var> with <var><a href="#preference">preference</a></var>.</p>
</li>
<li>
<p>If a <code title="preference readonly"><a href="#the-readonly-attribute">readonly</a></code> attribute is used, then let <var>readonly</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for
getting a single attribute value</a> to the <code title="preference readonly"><a href="#the-readonly-attribute">readonly</a></code> attribute. If <var>readonly</var> is not a <a href="#valid-boolean-value">valid boolean
value</a>, then let the value of <var>readonly</var> be the value
'<code>false</code>'. </p>
</li>
<li>
<p><a href="#associate">Associate</a> <var>readonly</var> with
the <var><a href="#preference">preference</a></var>.</p>
</li>
<li>
<p>Add the <var><a href="#preference">preference</a></var> and the <a href="#associate" title="associate">associated</a> <var>name</var>, <var>value</var> and <var>readonly</var> variables the list of <var><a href="#widget-preferences">widget preferences</a></var>.</p>
</li>
</ol></dd>
</dl><dl class="procedure"><dt>A <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element:</dt>
<dd>
<p id="ta-hkWmGJgfve">If this is not the first <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element encountered by the user agent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</dd>
<dd>
<p>If this is the first <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em>:</p>
</dd>
<dd>
<ol><li>
<p> Record that an attempt has been made by the user agent to process a <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element. </p>
</li>
<li>
<p id="ta-LTUJGJFCOU">If the <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute of the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element is absent or an empty string, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</li>
<li>
<p>Let <var>path</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting
a single attribute value</a> to the value of the <code>src</code> attribute.</p>
</li>
<li>
<p id="ta-pIffQywZin">If <var>path</var> is not a <a href="#valid-path">valid path</a>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</li>
<li>
<p id="ta-LQcjNKBLUZ">If <var>path</var> is a <a href="#valid-path">valid path</a>, then let <var title="">file</var> be the result of applying the <a href="#rule-for-finding-a-file-within-a-widget-package-0">rule for finding a file
within a widget package</a> to <var>path</var>. If <var><a href="#file">file</a></var> is <code><a href="#null">null</a></code> or in error, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</li>
<li>
<p>If the <code title="content type"><a href="#the-type-attribute">type</a></code> attribute of the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element is absent, then check
if <var title="">file</var> is <a href="#supported">supported</a> by the user agent by
applying the <a href="#rule-for-identifying-the-media-type-of-a-file-0">rule for identifying the media type of a file</a>. If
the <var title="">file</var> is <a href="#supported">supported</a>, then let the <var><a href="#widget-start-file">widget
start file</a></var> be the <a href="#file">file</a> referenced by the <code title="content src"><a href="#the-src-attribute-0">src</a></code> attribute and let <var><a href="#start-file-content-type">start file
content-type</a></var> be the <a href="#supported">supported</a> <a href="#media-type-0">media type</a> as
was derived by applying the <a href="#rule-for-identifying-the-media-type-of-a-file-0">rule for identifying the media type of a
file</a>.</p>
</li>
<li>
<p id="ta-dPOgiLQKNK">If the <code title="content encoding"><a href="#the-encoding-attribute">encoding</a></code> attribute is used, then let <var>content-encoding</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for
getting a single attribute value</a> to the value of the <code>encoding</code> attribute. If the character encoding represented by the value of <var>content-encoding</var> is <a href="#supported">supported</a> by the user agent, then let the <var><a href="#start-file-encoding">start file
encoding</a></var> be the value of <var>content-encoding</var>. If <var>content-encoding</var> is an empty string or <a href="#unsupported">unsupported</a> by the user agent,
then a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the <code title="content encoding"><a href="#the-encoding-attribute">encoding</a></code> attribute.</p>
</li>
<li>
<p id="ta-paIabGIIMC">If the <code title="content type"><a href="#the-type-attribute">type</a></code> attribute is used, then let <var>content-type</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for
getting a single attribute value</a> to the value of the <code title="content type"><a href="#the-type-attribute">type</a></code> attribute. If the value of <var>content-type</var> is a <a href="#media-type-0">media type</a> <a href="#supported">supported</a> by the user agent, then
let the <var><a href="#start-file-content-type">start file content-type</a></var> be the value of <var><a href="#the-type-attribute">content
type</a></var>. If value of <var>content-type</var> is <a href="#invalid">invalid</a> or <a href="#unsupported">unsupported</a> by the user agent, then a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat the <a href="#widget-package">widget package</a> as an <a href="#invalid-widget-package-0">invalid widget package</a>. </p>
</li>
<li>
<p id="ta-aaaaaaaaaa"> If the <var><a href="#start-file-encoding">start file encoding</a></var> was set in step 7 of this algorithm as a result of processing a valid and <a href="#supported">supported</a> value for the <code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code> element's <code title="content encoding"><a href="#the-encoding-attribute">encoding</a></code> attribute, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> skip this step in this algorithm. Otherwise, if the value of <var>content-type</var> is a <a href="#media-type-0">media type</a> <a href="#supported">supported</a> by the user agent and if <var>content-type</var> contains one or more <a href="#mime">[MIME]</a> <code title="mime parameter"><a href="#mime-parameter">parameter</a></code> components whose purpose is to declare the character encoding of the <a href="#start-file">start file</a> (e.g., the value "<samp>text/html;charset=Windows-1252</samp>", where <samp>charset</samp> is a parameter component whose purpose is to declare the character encoding of the start file), then let <var><a href="#start-file-encoding">start file encoding</a></var> be the value of the last <a href="#supported">supported</a> <code title="mime parameter"><a href="#mime-parameter">parameter</a></code> components whose purpose is to declare the character encoding of the <a href="#start-file">start file</a>. </p>
<div class="example">
<p>In the following example, the user agent would set the start file encoding to ISO-8859-1 and would ignore the charset parameter used in the type attribute. </p>
<pre><code><widget xmlns="http://www.w3.org/ns/widgets"> <br /> <content src = "start.php"
type = "text/html;charset=Windows-1252"
encoding = "ISO-8859-1" /><br /></widget></code></pre>
<p>In the following example the user agent would set the <var><a href="#start-file-encoding">start file encoding</a></var> to <code>Windows-1252</code>, if the user agent <a href="#supported" title="supported">supports</a> that character encoding. </p>
<pre><code><widget xmlns="http://www.w3.org/ns/widgets">
<content src = "start.php"
type = "text/html;charset=Windows-1252"/>
</widget></code></pre>
</div>
</li>
</ol></dd>
</dl><dl class="procedure"><dt>A <code title="feature element"><a href="#the-feature-element-and-its-attributes">param</a></code> element:</dt>
<dd>
<p id="ta-KNiLPOKdgQ"> If this <code title="param elemement">param</code> element is not a direct child of a <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> <var>element</var>.</p>
</dd>
<dd>
<p class="note"><span class="notetitle">Note:</span> How a param element is to be processed when it is inside a feature element is defined below.</p>
</dd>
</dl><dl class="procedure"><dt>A <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element:</dt>
<dd>
<p id="ta-rZdcMBExBX">The <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> process a feature element in the following manner: </p>
</dd>
<dd>
<ol><li>
<p>If the <code title="feature name"><a href="#the-name-attribute">name</a></code> attribute of this <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element is absent, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</li>
<li>
<p>Let <var>feature-name</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for
getting a single attribute value</a> to the value of the <code title="feature name"><a href="#the-name-attribute">name</a></code> attribute.</p>
<p class="note"><span class="notetitle">Note:</span> This specification allows <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> elements with the same <code title="feature name"><a href="#the-name-attribute">name</a></code> attribute value to be declared more than once. Handling of duplicate <a href="#feature-request" title="feature request">feature requests</a> is left up to the implementation or the specification that defines the feature. </p>
</li>
<li>
<p>If a <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute is used, then let <var>required-feature</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for
getting a single attribute value</a> to the <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute. If the <code title="feature required"><a href="#the-required-attribute">required</a></code> attribute is not used or if <var>required-feature</var> is not a <a href="#valid-boolean-value">valid boolean
value</a>, then let the value of <var>required-feature</var> be the value
'<code>true</code>'. </p>
</li>
<li>
<p id="ta-paWbGHyVrG">If <var>feature-name</var> is not a <a href="#valid-iri">valid IRI</a>, and <var>required-feature</var> is <code>true</code>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat this widget as
an <a href="#invalid-widget-package-0">invalid widget package</a>. </p>
</li>
<li>
<p id="ta-ignore-unrequired-feature-with-invalid-name">If <var>feature-name</var> is not a <a href="#valid-iri">valid IRI</a>, and <var>required-feature</var> is <code>false</code>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this element. </p>
</li>
<li>
<p id="ta-vOBaOcWfll">If <var>feature-name</var> is not <a href="#supported">supported</a> by the user
agent, and <var>required-feature</var> is <code>true</code>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> treat this widget as
an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
</li>
<li>
<p id="ta-luyKMFABLX">If <var>feature-name</var> is not <a href="#supported">supported</a> by the user
agent, and <var>required-feature</var> is <code>false</code>, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</li>
<li>
<p><a href="#associate">Associate</a> the value of <var>required-feature</var> with <var>feature-name</var>.</p>
</li>
<li>
<p>If the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element contains any <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> elements as direct descendants, then, for each child <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element that is a direct descendent of this <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element, starting from the first moving to
the last in <a href="http://www.w3.org/TR/xpath/#dt-document-order">document
order</a>:</p>
<ol style="list-style-type:upper-alpha"><li>
<p id="ta-EGkPfzCBOz">If a <code title="param value"><a href="#the-value-attribute">value</a></code> attribute is used, but
the <code title="param name"><a href="#the-name-attribute-0">name</a></code> attribute is absent, then this <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element is <a href="#in-error">in error</a> and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</li>
<li>
<p id="ta-xlgUWUVzCY">If a <code title="param name"><a href="#the-name-attribute-0">name</a></code> attribute is used, but the <code>value</code> attribute is absent, then this <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element is <a href="#in-error">in error</a> and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>.</p>
</li>
<li>
<p id="ta-CEGwkNQcWo">Let <var>param-name</var> be the result of applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule
for getting a single attribute value</a> to the <code title="param name"><a href="#the-name-attribute-0">name</a></code> attribute. If the <var>param-name</var> is an
empty string, then this <code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code> element is <a href="#in-error">in
error</a> and the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> this <var>element</var>. </p>
</li>
<li>
<p>If, and only if, <var>param-name</var> is not <a href="#in-error">in error</a> or an empty string, then let <var>param-value</var> be the result of
applying the <a href="#rule-for-getting-a-single-attribute-value-0">rule for getting a single attribute value</a> to
the <code title="param value"><a href="#the-value-attribute">value</a></code> attribute.</p>
</li>
<li>
<p><a href="#associate">Associate</a> <var>param-name</var> and <var>param-value</var> with <var>feature-name</var>.</p>
</li>
</ol></li>
<li>
<p>Append <var>feature-name</var>, and any associated <var>required-feature</var>, and associated <a href="#parameter" title="parameter">parameters</a>, to the <var><a href="#feature-list">feature list</a></var>.</p>
</li>
</ol></dd>
<dt><dfn id="process-any-element">Any other type of element</dfn>:</dt>
<dd>
<p id="ta-bbbbbbbbbb">If the user agent <a href="#supported" title="supported">supports</a> the element, then the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> process it in accordance with whatever specification defines that element (if any). Otherwise, the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> <a href="#ignore">ignore</a> the element.</p>
</dd>
</dl></li>
</ol><h3 class="no-num done" id="step-8-locate-the-start-file"><dfn>Step 8</dfn> - Locate the Start File</h3>
<p id="ta-BnWPqNvNVo">If <var><a href="#widget-start-file">widget start file</a></var> of the <a href="#table-of-configuration-defaults">table of configuration defaults</a> contains a <a href="#file">file</a> (i.e. <var><a href="#widget-start-file">widget start file</a></var> is not <code><a href="#null">null</a></code>), then a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> skip <a href="#step-8-locate-the-start-file">Step 8</a> and go
to <a href="#step-9-process-the-default-icons">Step 9</a>. </p>
<p id="ta-RGNHRBWNZV">If <var><a href="#widget-start-file">widget start file</a></var> does not contain a <a href="#file">file</a>, the <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> apply the <a href="#algorithm-to-locate-a-default-start-file">algorithm to locate a default start file</a>.</p>
<p>The <dfn id="algorithm-to-locate-a-default-start-file">algorithm to locate a default start file</dfn> is as follows: </p>
<ol><li>
<p>For each <var>file name</var> in the <a href="#default-start-files-table">default start files table</a> (from
top to bottom) that has a <a href="#media-type-0">media type</a> that is <a href="#supported">supported</a> by
the user agent:</p>
<ol><li>
<p>Let <var>potential-start-file</var> be the result of applying the <a href="#rule-for-finding-a-file-within-a-widget-package-0">rule
for finding a file within a widget package</a> to <var>file name</var>.</p>
</li>
<li>
<p>If <var>potential-start-file</var> is <code><a href="#null">null</a></code> or <a href="#in-error">in
error</a>, <a href="#ignore">ignore</a> this <var>file name</var> and move onto the
next <var>file name</var> in the <a href="#default-start-files-table">default start files table</a>.</p>
</li>
<li>
<p>If <var>potential</var><var>-start-file</var> is a <a href="#file">file</a>, then:</p>
<ol><li>
<p>Let <var><a href="#widget-start-file">widget start file</a></var> be the value of <var>potential-</var><var>start-file</var>.</p>
</li>
<li>
<p>Let <var><a href="#start-file-content-type">start file content-type</a></var> be the <a href="#media-type-0">media type</a> given in the media type column of the <a href="#default-start-files-table">default start files
table</a>.</p>
</li>
<li>
<p>Terminate this algorithm and go to <a href="#step-9-process-the-default-icons">Step 9</a>.</p>
</li>
</ol></li>
</ol></li>
<li>
<p>If after searching for every <var title="">file</var> in the <a href="#default-start-files-table">default start
files table</a> no default start file is found, then treat this widget as an <a href="#invalid-widget-package-0">invalid widget package</a>.</p>
</li>
</ol><h3 class="no-num done" id="step-9-process-the-default-icons"><dfn>Step 9</dfn> - Process the Default Icons</h3>
<p>This step describes how to locate the <a href="#default-icons-table" title="default icons table">default
icons</a>.</p>
<p id="ta-FAFYMEGELU">In <a href="#step-9-process-the-default-icons">Step 9</a>, a <a class="product-ua" href="#user-agent">user agent</a> <em class="ct">must</em> apply the <a href="#algorithm-to-locate-the-default-icons">algorithm to locate the default icons</a>.</p>
<p>The <dfn id="algorithm-to-locate-the-default-icons">algorithm to locate the default icons</dfn> is as follows:</p>
<ol><li>
<p>For each <var>file name</var> in the <a href="#default-icons-table">default icons table</a> (from top to
bottom) that has a <a href="#media-type-0">media type</a> that is <a href="#supported">supported</a> by the user
agent:</p>
<ol><li>
<p>Let <var>potential-icon</var> be the result of applying the <a href="#rule-for-finding-a-file-within-a-widget-package-0">rule for
finding a file within a widget package</a> to <var>file name</var>.</p>
</li>
<li>
<p>If the <var>potential-icon</var> is a <a href="#processable-file">processable file</a>, determined
by the <a href="#media-type-0">media type</a> given in the media type column of the <a href="#default-icons-table">default icons table</a>, and the <var>potential-icon</var> does not already exist in the <var><a href="#icons-0">icons</a></var> list of the <a href="#table-of-configuration-defaults">table of configuration defaults</a>, then append the value of <var>potential-icon</var> to the <var><a href="#icons-0">icons</a></var> list of the <a href="#table-of-configuration-defaults">table of
configuration defaults</a>. </p>
</li>
<li>
<p>Move onto the next <var>file name</var> in the <a href="#default-icons-table">default icons
table</a>.</p>
</li>
</ol></li>
</ol><h2 class="no-num" id="appendix">Appendix</h2>
<h3 class="no-num" id="media-type-registration-for-application-widget">Media Type Registration for <code>application/widget</code></h3>
<p>This appendix is the MIME media type registration for "<code>application/widget</code>". This registration has been <a href="http://www.iana.org/assignments/media-types/application/">approved</a> by the Internet Assigned Numbers Authority (<abbr title="Internet Assigned Numbers Authority">IANA</abbr>) . </p>
<p>Registration with <abbr title="Internet Assigned Numbers Authority">IANA</abbr> was conducted in conformance with <a href="http://www.ietf.org/rfc/rfc4288.txt">BCP 13</a> and <a href="http://www.w3.org/2002/06/registering-mediatype.html">W3CRegMedia</a>. </p>
<dl><dt>Type name: </dt>
<dd>
<p><code>application</code></p>
</dd>
<dt>subtype name:</dt>
<dd>
<p><code><a href="#widget">widget</a></code></p>
</dd>
<dt>Required parameters:</dt>
<dd>
<p>None.</p>
</dd>
<dt> Optional parameters:</dt>
<dd>
<p> None.</p>
</dd>
<dt>Encoding considerations:</dt>
<dd>
<p>Widget packages are binary data and thus are encoded for MIME
transmission. As a widget package is binary, it requires encoding on transports not capable of
handling binary. The same guidelines that apply to <code>application/octet-stream</code> apply to widget packages (see <a href="#mime">[MIME]</a>). </p>
</dd>
<dt>Security considerations:</dt>
<dd>
<p>In addition to the security considerations specified for Zip files in the <a href="#zip-mime">[Zip-MIME]</a> registration, there are a number of security considerations that need to be taken into account when dealing with <a href="#widget-package" title="widget package">widget packages</a> and <a href="#configuration-document-0" title="configuration document">configuration documents</a>. </p>
<p>As the <a href="#configuration-document-0"> configuration document</a> format is <a href="#xml">[XML]</a> and will commonly be encoded using <a href="#unicode">[Unicode]</a>, the security considerations described in <a href="#xml-mime">[XML-MIME]</a> and <a href="#refsUTR">[UTR36]</a> apply. In addition, implementers need to impose their own implementation-specific limits on the values of otherwise unconstrained attribute types, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around platform-specific limitations.</p>
<p>The configuration document allows authors, through the <code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code> element, to request permission to enable third-party runtime components and APIs. As these features are outside the scope of this specification, significant caution needs to be taken when granting a widget the capability to use a feature. Features themselves define their own security considerations. </p>
<p> <a href="#widget-package" title="widget package">Widget packages</a> will generally contain ECMAscript, HTML, CSS files, and other media, which are executed in a sand boxed environment. As such, implementers need to be aware of the security implications for the types they <a href="#supported" title="supported">support</a>. Specifically, implementers need to consider the security implications outlined in the [CSS-MIME] specification, the <a href="#ecmascript-mime">[ECMAScript-MIME]</a> specification, and the <a href="#html-mime">[HTML-MIME]</a> specification. </p>
<p>As widget packages can contain content that is able to simultaneously interact with the local device and a remote host, implementers need to consider the privacy implications resulting from exposing private information to a remote host. Mitigation and in-depth defensive measures are an implementation responsibility and not prescribed by this specification. However, in designing these measures, implementers are advised to enable user awareness of information sharing, and to provide easy access to interfaces that enable revocation of permissions. </p>
<p> As this specification relies on the standardized heuristics for determining the content type of files defined in the <a href="#sniff">[SNIFF]</a> specification, implementers need to consider the security considerations discussed in the <a href="#sniff">[SNIFF]</a> specification.</p>
<p>As this specification allows for the declaration of IRIs within certain elements of a configuration documents, implementers need to consider the security considerations discussed in the <a href="#iri">[IRI]</a> specification. Implementations intending to display <abbr title="Internationalized Resource Identifiers">IRIs</abbr> and <abbr title="Internationalized domain name">IDNA</abbr> addresses found in the <a href="#configuration-document-0">configuration document</a> are strongly encouraged to follow the security advice given in <a href="#refsUTR">[UTR36]</a>. This could include, for example, behaving as if the <code><a href="#the-dir-attribute">dir</a></code> attribute had no effect on any <a href="#iri-attribute" title="IRI attribute">IRI attributes</a>, <a href="#path-attribute" title="path attribute">path attributes</a>, and the <code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code> element's <code title="author email"><a href="#the-email-attribute">email</a></code> attribute.</p>
<p>In addition, user agents need to be careful about trusting path components
found in the widget package. Such path components might be interpreted
by operating systems as pointing at security critical files outside
the widget environment proper, and naive unpacking of widget
packages into the file system might lead to undesirable and security
relevant effects, such as overwriting of system files. </p>
</dd>
<dt>Interoperability considerations:</dt>
<dd>
<p>Some issues can arise with regards to character encodings of file names, the length of zip relative paths, and the use of certain strings as file names. </p>
<p>This specification does not put a restriction on the byte length of a <a href="#zip-relative-path">Zip
relative path</a>, so a user agent <em class="ct">should</em> to be able to deal with <a href="#zip-relative-path" title="Zip relative path">Zip relative paths</a> that have lengths longer than 250 bytes. As some operating systems have restrictions on how long a path length can be, authors need to keep the lengths of relative paths at less than 250 bytes. Unicode code points may
require more than one byte to encode a character, which can result in a path whose
length is less than 250 characters but whose size is greater than 250 bytes. </p>
<p>Authors need to be aware that, at the time of publication, there are
interoperability issues with regards to using characters outside the <code>safe-chars</code> range for file or folder names in a Zip archive when using
Zipping tools bundled with operating systems. The interoperability issues have
arisen from non-conforming implementations of the <a href="#zip">[ZIP]</a> specification
across operating systems: very few, if any, correctly support encoding file names
in Unicode.</p>
<p>In the case where the Zip relative path is encoded using <a href="#utf-8">[UTF-8]</a>, the <dfn class="external" id="language-encoding-flag-efs">language encoding flag (EFS)</dfn> needs to be set.</p>
<p>If an author chooses to use the <code>utf8-chars</code>, they need to thoroughly
test their widgets on various platforms prior to distribution; otherwise it is
suggested that authors restrict file and folder names to the <code>safe-chars</code> (characters in the US-ASCII range). In addition, having
excessively long path names (e.g. over 120 characters) can also result in
interoperability issues on some operating systems. </p>
<p> Authors need to avoid using <a href="#zip-forbidden-characters">Zip forbidden
characters</a> when naming the files used by a widget. These characters are reserved to
maintain interoperability across various file systems and with <a href="#uri">[URI]</a>s.</p>
<p>Authors need to avoid using the following words as either a <a href="#folder"><code>folder</code></a> or
a <a href="#file-name"><code>file-name</code></a> in a <a href="#zip-relative-path">Zip relative path</a> as they
are reserved by some operating systems (case-insensitive): CON, PRN, AUX, NUL,
COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5,
LPT6, LPT7, LPT8, LPT9, CLOCKS$. For example, the following names are ok:
"CON-tact.txt", "printer.lpt1", "DCOM1.pdf". However, "com3.txt" "Lpt1", "CoM9.gif"
would not be.</p>
<p>In addition, authors need to avoid having a "." U+002E FULL STOP as the last character of a
file or folder name as some operating systems will remove the character when the
file is extracted from the Zip archive onto the device. Furthermore, avoid having
the space character (<a href="#sp">SP</a>) at the start or end of a file name; and take
caution when using the "+" U+002B PLUS SIGN, as it might cause issues on some
operating systems.</p>
</dd>
<dt>Published specification:</dt>
<dd>
<p><a href="http://www.w3.org/TR/widgets/">http://www.w3.org/TR/widgets/</a></p>
</dd>
<dt>Applications that use this media type:</dt>
<dd>
<p>User agents that claim conformance to this specification. </p>
</dd>
<dt>Magic number(s):</dt>
<dd>
<p><code>50 4B 03 04</code></p>
</dd>
<dt> File extension(s):</dt>
<dd>
<p>wgt</p>
</dd>
<dt>Macintosh file type code(s):</dt>
<dd>
<p>None. </p>
</dd>
<dt>Person & email address to contact for further information:</dt>
<dd>
<p>Steven Pemberton, <a href="mailto:member-webapps@w3.org">member-webapps@w3.org</a></p>
</dd>
<dt>Intended usage: </dt>
<dd>
<p>Common. </p>
</dd>
<dt>Restrictions on usage: </dt>
<dd>
<p>None.</p>
</dd>
<dt>Author:</dt>
<dd>
<p><a href="http://www.w3.org/2008/webapps/">The W3C's Web Applications Working Group</a></p>
</dd>
</dl><h3 class="no-num" id="linking-to-a-widget-package-from-a-html-document">Linking To a Widget Package From a HTML Document</h3>
<p><em>This section is non-normative.</em></p>
<p><em>This section only applies to HTML user agents <a href="#html">[HTML]</a>.</em></p>
<p><dfn id="auto-discovery">Auto-discovery</dfn> enables a user agent to identify and install a <a href="#widget-package">widget package</a> that is associated with an HTML page. When a page points to
a <a href="#widget-package">widget package</a>, user agents <em class="ct">should</em> expose the presence of the <a href="#widget-package">widget package</a> to the end-user and allow the end-user to install the <a href="#widget">widget</a>.</p>
<p>The link type "<code title="">widget</code>" indicates that a link of this type
references a document that is a <a href="#widget-package">widget package</a>. In HTML, it may be
specified for the <code title="">a</code>, <code title="">area</code> and <code title="">link</code> elements to create a hyperlink.</p>
<div class="example">
<p>For example:</p>
<pre>
<code><a rel="widget"
href="http://example.org/exampleWidget">
The Example Widget
</a></code>
</pre>
</div>
<h3 class="no-num" id="table-of-elements-and-their-attributes">Table of Elements and Their Attributes</h3>
<p><em>This section is non-normative.</em></p>
<p>This table lists all elements and respective attributes, as well as child-parent relationships, that make up the language of the <a href="#configuration-document-0">configuration document</a> format defined in this specification. </p>
<table><tr><th scope="col">Element</th>
<th scope="col">Description</th>
<th scope="col">Parent</th>
<th scope="col">Expected Children</th>
<th scope="col">Attributes</th>
<th scope="col">Type</th>
</tr><tr><td rowspan="8"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="8">The root element of a <a href="#configuration-document-0">configuration document</a>.</td>
<td rowspan="8">none. </td>
<td rowspan="8"><ul><li><code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code></li>
<li><code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code></li>
<li><code title="author element"><a href="#the-author-element-and-its-attributes">author </a></code></li>
<li><code title="license element"><a href="#the-license-element-and-its-attributes">license </a></code></li>
<li><code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code></li>
<li><code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code></li>
<li><code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code></li>
<li><code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code></li>
</ul></td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="widget id"><a href="#the-id-attribute">id</a></code></td>
<td><a href="#iri-attribute" title="IRI attribute">IRI</a></td>
</tr><tr><td><code title="widget version"><a href="#widget-version">version</a></code></td>
<td><a href="#version-attribute" title="version attribute">version</a></td>
</tr><tr><td><code title="widget height"><a href="#widget-height">height</a></code></td>
<td><a href="#numeric-attribute" title="numeric attribute">numeric</a></td>
</tr><tr><td><code title="widget width"><a href="#widget-width">width</a></code></td>
<td><a href="#numeric-attribute" title="numeric attribute">numeric</a></td>
</tr><tr><td><code title="widget viewmodes"><a href="#the-viewmodes-attribute">viewmodes</a></code></td>
<td><a href="#keyword-list-attribute" title="keyword list attribute">Keyword list</a></td>
</tr><tr><td><code title="widget defaultlocale"><a href="#the-defaultlocale-attribute">defaultlocale</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td rowspan="3"><code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code></td>
<td rowspan="3">The name of the widget. </td>
<td rowspan="3"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="3"><ul><li><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code>, </li>
<li><a href="#text-node">text node</a></li>
</ul></td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="name short"><a href="#the-short-attribute">short</a></code></td>
<td><a href="#displayable-string-attribute" title="displayable-string attribute">displayable-string</a></td>
</tr><tr><td rowspan="2"><code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code></td>
<td rowspan="2">Some text that describes the purpose of the widget.</td>
<td rowspan="2"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="2"><ul><li><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code></li>
<li> <a href="#text-node">text node</a></li>
</ul></td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td rowspan="4"><code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code></td>
<td rowspan="4">The person or person that created the widget.</td>
<td rowspan="4"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="4"><ul><li><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code></li>
<li><a href="#text-node">text node</a></li>
</ul></td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="author-element href"><a href="#the-href-attribute">href</a></code></td>
<td><a href="#iri-attribute" title="IRI attribute">IRI</a></td>
</tr><tr><td><code title="author email"><a href="#the-email-attribute">email</a></code></td>
<td><a href="#string-attribute" title="string attribute">string</a></td>
</tr><tr><td rowspan="3"><code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code></td>
<td rowspan="3">The license under which the widget is distributed.</td>
<td rowspan="3"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="3"><ul><li><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code></li>
<li><a href="#text-node">text node</a></li>
</ul></td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="license href"><a href="#the-href-attribute-0">href</a></code></td>
<td><a href="#iri-attribute" title="IRI attribute">IRI</a> or <a href="#path-attribute" title="path attribute">path</a></td>
</tr><tr><td rowspan="5"><code title="icon element"><a href="#the-icon-element-and-its-attributes">icon</a></code></td>
<td rowspan="5">An iconic representation of the widget.</td>
<td rowspan="5"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="5">none.</td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="icon src"><a href="#the-src-attribute">src</a></code></td>
<td><a href="#path-attribute" title="path attribute">path</a></td>
</tr><tr><td><code title="icon width"><a href="#the-width-attribute-0">width</a></code></td>
<td><a href="#numeric-attribute" title="numeric attribute">numeric</a></td>
</tr><tr><td><code title="icon height"><a href="#the-height-attribute-0">height</a></code></td>
<td><a href="#numeric-attribute" title="numeric attribute">numeric</a></td>
</tr><tr><td rowspan="5"><code title="content element"><a href="#the-content-element-and-its-attributes">content</a></code></td>
<td rowspan="5">The means to point to the "main file" of a widget; serves as a boot-strapping mechanism. </td>
<td rowspan="5"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="5">none.</td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="content src"><a href="#the-src-attribute-0">src</a></code></td>
<td><a href="#numeric-attribute" title="numeric attribute">numeric</a></td>
</tr><tr><td><code title="content type"><a href="#the-type-attribute">type</a></code></td>
<td><a href="#media-type-attribute" title="Media type attribute">media type</a></td>
</tr><tr><td><code title="content encoding"><a href="#the-encoding-attribute">encoding</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td rowspan="4"><code title="feature element"><a href="#the-feature-element-and-its-attributes">feature</a></code></td>
<td rowspan="4">A means to request the availability of a <a href="#feature">feature</a>, such as an API, that would not normally be part of the default set of features provided by the user agent at runtime. </td>
<td rowspan="4"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="4"><ul><li><code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code>.</li>
</ul></td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="feature name"><a href="#the-name-attribute">name</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="feature required"><a href="#the-required-attribute">required</a></code></td>
<td><a href="#boolean-attribute" title="boolean attribute">boolean</a></td>
</tr><tr><td rowspan="5"><code title="preference element"><a href="#the-preference-element-and-its-attributes">preference</a></code></td>
<td rowspan="5">A means to declare a name-value pair that is made available to the widget at runtime.</td>
<td rowspan="5"><code title="widget element"><a href="#the-widget-element-and-its-attributes">widget</a></code></td>
<td rowspan="5">none.</td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="preference name"><a href="#the-name-attribute-1">name</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="preference value"><a href="#the-value-attribute-0">value</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="preference readonly"><a href="#the-readonly-attribute">readonly</a></code></td>
<td><a href="#boolean-attribute" title="boolean attribute">boolean</a></td>
</tr><tr><td rowspan="4"><code title="param element"><a href="#the-param-element-and-its-attributes">param</a></code></td>
<td rowspan="4">A means of declaring a <a href="#parameter">parameter</a> that can be used with a <a href="#feature">feature</a>. </td>
<td rowspan="4"><code title="preference element"><a href="#the-preference-element-and-its-attributes">feature</a></code></td>
<td rowspan="4">none.</td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr><tr><td><code title="param name"><a href="#the-name-attribute-0">name</a></code></td>
<td><a href="#string-attribute" title="string attribute">string</a></td>
</tr><tr><td><code title="param value"><a href="#the-value-attribute">value</a></code></td>
<td><a href="#string-attribute" title="string attribute">string</a></td>
</tr><tr><td rowspan="2"><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code></td>
<td rowspan="2">A generic text container which is mainly used for internationalization purposes. </td>
<td rowspan="2"><ul><li><code title="name element"><a href="#the-name-element-and-its-attributes">name</a></code></li>
<li><code title="description element"><a href="#the-description-element-and-its-attributes">description</a></code></li>
<li><code title="author element"><a href="#the-author-element-and-its-attributes">author</a></code></li>
<li><code title="license element"><a href="#the-license-element-and-its-attributes">license</a></code></li>
</ul></td>
<td rowspan="2"><ul><li><code title="span element"><a href="#the-span-element-and-its-attributes">span</a></code></li>
<li> <a href="#text-node">text node</a></li>
</ul></td>
<td><code><a href="#the-xml:lang-attribute">xml:lang</a></code></td>
<td><a href="#language-attribute" title="language attribute">language</a></td>
</tr><tr><td><code><a href="#the-dir-attribute">dir</a></code></td>
<td><a href="#keyword-attribute" title="keyword attribute">keyword</a></td>
</tr></table><h2 class="no-num" id="acknowledgements">Acknowledgements</h2>
<p>Huge thanks to everyone who contributed their time and sent feedback to our public mailing, particularly the i18n WG. </p>
<p>This specification would not exist without the contribution of the following individuals:</p>
<p>Aaron Boodman, Adam Barth, Addison Phillips, Alexander Dreiling, Andrew Sledd, Andrew Welch, Arun Ranganathan, Arthur Barstow, Bárbara
Barbosa Neves, Bil Corry, Brian Wilson, Bjoern Hoehrmann, Benoit Suzanne, Bert Bos, Boris Zbarsky,
Bradford Lassey, Bryan Sullivan, Cameron McCormack, Cliff Schmidt, Claudio Venezia, Coach Wei, Corin
Edwards, Cynthia Shelly, Cyril Concolato, Dan Brickley, Dan Connolly, Daniel Silva, David Clarke, Dean Jackson, David Poehlman, David Pollington, David Rogers, Dominique Hazael-Massieux, Doug Schepers, Ed
Voas, Felix Sasaki, Francois Daoust, Frederick Hirsch, Gautam Chandna, Geir Pedersen, Gene Vayngrib, Gorm
Haug Eriksen, Guido Grassel, Guenter Klas, Hans S. Tømmerholt, Hari Kumar G, Henri Sivonen, Henry Story, Ian Hickson, Ivan Demarino, Jay Sweeney, Jean-Claude Dufourd, Jeff Decker, Jere Käpyaho, Jim
Ley, Jo Rabin, Jon Ferraiolo, Jonas Sicking, Jose Manuel Cantera Fonseca, Josh Soref, Jouni Hakala, Joey
Bacalhau, Julian Reschke, Kevin Lawver, Kai Hendry, Krzysztof Maczyński, Lachlan Hunt, Larry Masinter, Laurens Holst, Mark Priestley, Marc Silbey,
Marcin Hanclik, Mark Baker, Martin J. Dürst, Michael Cooper, Max Froumentin, Mikko Pohja, Mohamed Zergaoui, Ms2ger, Najib Tounsi, Noah Mendelsohn, Oguz Kupusoglu, Ola Andersson, Olli Immonen, Paddy Byers, Paul Libbrecht , Philipp
Heltewig, Philip Taylor, Rainer Hillebrand, Robert Sayre, Rune <abbr title="Fabulous">F.</abbr> Halvorsen, Samuel Santos, Scott Wilson, Sean Mullan, Sigbjorn Finne, Simon Pieters, Stephen Paul Weber, Stephen Jolly, Stephane Sire, Steven Faulkner, Thomas Landspurg, Thomas Roessler, Tiago Neves, William Edney, Yoan Blanc, Yves Savourel.</p>
<p>Special thanks go to Arve Bersvendsen, Robin Berjon, and Charles
McCathieNevile who helped edit various versions of this specification. </p>
<p>A big thanks to Anne van Kesteren for being such a great supporter of this work! Also, huge thanks to the folks at Apple, specially Maciej Stachowiak, who <a href="http://www.w3.org/2009/03/widgets-pag/pagreport.html">contributed immensely</a> to make all the widgets specs free and open!</p>
<p>Special thanks also to <a href="http://hasather.net/">David Håsäther</a> for
creating and maintaining the <a href="#widgets-relax-ng-schema">[Widgets-Relax NG Schema]</a> for the configuration document format.</p>
<p>Parts of this document reproduce text and behavior from the <a href="#html">[HTML]</a> specification and from the <a href="http://www.w3.org/TR/xbl/">XBL 2.0
specification</a> (as permitted by both specifications by their copyright
statements).</p>
<p>Graphic icons used some examples of this specification were created by <a href="http://www.pinvoke.com/">Yusuke Kamiyamane</a> and are available for use under a <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0
license</a>.</p>
<p>This specification is dedicated to the children of India.</p>
<h2 class="no-num" id="normative-references">Normative References</h2>
<dl><dt><dfn id="abnf">[ABNF]</dfn></dt>
<dd><a href="http://www.ietf.org/rfc/rfc5234.txt"><cite>Augmented BNF for Syntax
Specifications: <abbr title="Augmented Backus-Naur Form">ABNF</abbr></cite></a>.
RFC5234. D. Crocker and P. Overell. January 2008.</dd>
<dt><dfn id="bidi">[BIDI]</dfn></dt>
<dd><cite><a href="http://unicode.org/reports/tr9/">Unicode Standard Annex #9: Unicode Bidirectional Algorithm</a></cite>. M. Davis.</dd>
<dt><dfn id="bcp47">[BCP47]</dfn></dt>
<dd><cite><a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">Tags for Identifying Languages</a></cite>, A. Phillips and M. Davis. September 2009.</dd>
<dt><dfn id="cp437">[CP437]</dfn></dt>
<dd><cite><a href="ftp://ftp.software.ibm.com/software/globalization/gcoc/attachments/CP00437.txt">IBM CPGID 00437</a></cite>. Code Page 47, Character Encoding Scheme. 1984. </dd>
<dt><dfn id="css2">[CSS2]</dfn></dt>
<dd><cite><a href="http://www.w3.org/TR/CSS21/">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>.</cite> B. Bos, I. Hickson, T.
Çelik, H. Wium Lie. W3C Recommendation 07 June 2011.</dd>
<dt><dfn id="css-mime">[CSS-MIME]</dfn></dt>
<dd><cite><a href="http://www.rfc-editor.org/rfc/rfc2318.txt">The text/css Media Type </a></cite>. RFC 2318. H. Lie, B. Bos, and C. Lilley. IETF. March 1998.</dd>
<dt><dfn id="deflate">[Deflate]</dfn></dt>
<dd><a href="http://www.faqs.org/rfcs/rfc1951.html"><cite>DEFLATE Compressed Data
Format Specification version 1.3</cite></a>. P. Deutsch, The Internet Society, May
1996.</dd>
<dt><dfn id="dom3core">[DOM3Core]</dfn></dt>
<dd><a href="http://www.w3.org/TR/DOM-Level-3-Core/"><cite>Document Object Model
(DOM) Level 3 Core Specification</cite></a>. A. Le Hors, P. Le Hégaret, L. Wood, G.
Nicol, J. Robie, M. Champion, S. Byrne, editors. W3C Recommendation 07 April 2004.</dd>
<dt><dfn id="iana-charsets">[IANA-Charsets]</dfn></dt>
<dd><a href="http://www.iana.org/assignments/character-sets"><cite>IANA Character Set
Registry</cite></a>.</dd>
<dt><dfn id="iri">[IRI]</dfn></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc3987">Internationalized Resource
Identifiers (IRIs)</a></cite>. RFC3987, M. Duerst, M. Suignard. January 2005.</dd>
<dt><dfn id="mime">[MIME]</dfn></dt>
<dd><a href="http://www.ietf.org/rfc/rfc2045.txt"><cite>Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message Bodies</cite></a>. RFC2045, N.
Freed and N. Borenstein, IETF, November 1996.</dd>
<dd><a href="http://www.ietf.org/rfc/rfc2046.txt"><cite>Multipurpose Internet Mail
Extensions(MIME) Part Two: Media Types</cite></a>. RFC2046, N. Freed and N.
Borenstein, IETF, November 1996.</dd>
<dt><dfn id="rfc2119">[RFC2119]</dfn></dt>
<dd><a href="http://www.ietf.org/rfc/rfc2119"><cite>Key words for use in RFCs to
Indicate Requirement Levels</cite></a>. RFC2119, S. Bradner. March 1997.</dd>
<dt><dfn id="sniff">[SNIFF]</dfn></dt>
<dd><a href="http://tools.ietf.org/html/draft-ietf-websec-mime-sniff"><cite>Media Type Sniffing</cite></a>. A. Barth and I. Hickson. IETF (Work in Progress).</dd>
<dt><dfn id="unicode">[Unicode]</dfn></dt>
<dd> <cite><a href="http://www.unicode.org/versions/latest/">The Unicode Standard</a></cite>. </dd>
<dt><dfn id="uri">[URI]</dfn></dt>
<dd><a href="http://www.ietf.org/rfc/rfc3986.txt"><cite>Uniform Resource Identifier
(URI): Generic Syntax</cite></a>. RFC 3986, T. Berners-Lee, R. Fielding and L.
Masinter. January 2005.</dd>
<dt><dfn id="utf-8">[UTF-8]</dfn></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc3629.txt">UTF-8: A Transformation
format of ISO 1064</a></cite>. RFC 3629, F. Yergeau. IETF, November 2003.</dd>
<dt><dfn id="widgets-digsig">[Widgets-DigSig]</dfn></dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets-digsig/"><cite>XML Digital
Signatures for Widgets</cite></a>. M. Cáceres, Paddy Byers, Stuart Knightley, F. Hirsch, and M. Priestley. W3C Proposed Recommendation (work in progress).</dd>
<dt><dfn id="view-modes">[View-Modes]</dfn></dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets-vmmf/"><cite>The 'view-mode' Media Feature</cite></a>. R. Berjon. Proposed Recommendaiton (Work in Progress). </dd>
<dt><dfn id="xml">[XML]</dfn></dt>
<dd><cite><a href="http://www.w3.org/TR/2008/REC-xml-20081126/">Extensible Markup
Language (XML) 1.0 (Fifth Edition)</a></cite>. T. Bray, J. Paoli, C. M.
Sperberg-McQueen, E. Maler, F. Yergeau. W3C Recommendation 26 November 2008.</dd>
<dt><dfn id="xml-mime">[XML-MIME]</dfn></dt>
<dd><a href="http://www.rfc-editor.org/rfc/rfc3023.txt"><cite>XML Media Types</cite></a>. RFC3023. M. Murata, S. St. Laurent, D. Kohn. IETF. January 2001. </dd>
<dt><dfn id="xmlns">[XMLNS]</dfn></dt>
<dd><a href="http://www.w3.org/TR/2006/REC-xml-names-20060816/"><cite>Namespaces in
XML (Second Edition)</cite></a>. T. Bray, D. Hollander, A. Layman, R. Tobin. W3C Recommendation,
August 2006.</dd>
<dt><dfn id="zip">[ZIP]</dfn> </dt>
<dd><a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT"><cite>.Zip File
Format Specification</cite></a>. PKWare Inc.</dd>
<dt><dfn id="zip-mime">[ZIP-MIME]</dfn></dt>
<dd><a href="http://www.iana.org/assignments/media-types/application/zip">IANA Media Type
Assignment.</a></dd>
</dl><h2 class="no-num" id="informative-references">Informative References</h2>
<dl><dt><dfn id="ecmascript-mime">[ECMAScript-MIME]</dfn></dt>
<dd><a href="http://www.rfc-editor.org/rfc/rfc4329.txt"><cite>Scripting Media Types</cite></a>. RFC4329. B. Hoehrmann. IETF. April 2006.</dd>
<dt><dfn id="html">[HTML]</dfn></dt>
<dd> </dd>
<dd><cite><a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML - Living Standard</a></cite>. I. Hickson. WHATWG. </dd>
<dt><dfn id="html-mime">[HTML-MIME]</dfn></dt>
<dd><a href="http://www.rfc-editor.org/rfc/rfc2854.txt">The 'text/html' Media Type</a>. D. Connolly and L. Masinter. IETF. June 2000.</dd>
<dt><dfn id="http">[HTTP]</dfn></dt>
<dd><a href="http://www.ietf.org/rfc/rfc2616.txt"><cite>Hypertext Transfer Protocol
-- HTTP/1.1</cite></a>. RFC 2616, R. Fielding, et al. June 1999.</dd>
<dt><dfn id="svgtiny">[SVGTiny]</dfn></dt>
<dd><cite><a href="http://www.w3.org/TR/2008/REC-SVGTiny12-20081222/">Scalable Vector
Graphics (SVG) Tiny 1.2 Specification</a></cite>. O. Andersson, R. Berjon, E.
Dahlström, A. Emmons, J. Ferraiolo, A. Grasso, V. Hardy, S. Hayman, D. Jackson, C.
Lilley, C. McCormack, A. Neumann, C. Northway, A. Quint, N. Ramani, D. Schepers, A.
Shellshear. W3C Recommendation, 22 December 2008.</dd>
<dt><dfn id="refsUTR">[UTR36]</dfn></dt>
<dd><cite><a href="http://unicode.org/reports/tr36/">UTR #36: Unicode
Security Considerations</a></cite>, M. Davis, M. Suignard. Unicode
Consortium.</dd>
<dt><dfn id="widgets-landscape">[Widgets-Landscape]</dfn></dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets-land/"><cite>The Widget
Landscape (Q1 2008)</cite></a>. M. Cáceres. (Work in
progress).</dd>
<dt><dfn id="widgets-requirements">[Widgets-Requirements]</dfn></dt>
<dd><cite><a href="http://dev.w3.org/2006/waf/widgets-reqs/">Widgets Requirements</a></cite>, M. Cáceres and M. Priestley. W3C Working Draft (Work in progress).</dd>
<dt><dfn id="widgets-relax-ng-schema">[Widgets-Relax NG Schema]</dfn></dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets-schema/widgets.rnc"><cite>Relax NG Schema for the Widgets Family of Specifications</cite></a>. D. Håsäther, R. Berjon, and M. Cáceres.</dd>
<dt><dfn id="widgets-test-suite">[P&C-Test-Suite]</dfn></dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets/test-suite/"><cite>Test Suite for Widget Packaging and XML Configuration</cite></a>. M. Cáceres. </dd>
<dt><dfn id="widgets-apis">[Widgets-APIs]</dfn></dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets-api/"><cite>The Widget Interface</cite></a>. M. Cáceres.
(Work in progress).</dd>
<dt><dfn id="widgets-uri">[Widgets-URI]</dfn></dt>
<dd><a href="http://dev.w3.org/2006/waf/widgets-uri/"><cite>Widget URI Scheme</cite></a>. R. Berjon. (Work in
progress).</dd>
</dl></div>
<!-- script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="../widgets-shared/javascript/viewTests.js"></script-->
</body></html>