File: Element.cs

package info (click to toggle)
mono 4.6.2.7+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 778,148 kB
  • ctags: 914,052
  • sloc: cs: 5,779,509; xml: 2,773,713; ansic: 432,645; sh: 14,749; makefile: 12,361; perl: 2,488; python: 1,434; cpp: 849; asm: 531; sql: 95; sed: 16; php: 1
file content (1847 lines) | stat: -rw-r--r-- 79,744 bytes parent folder | download
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
//**************************************************************************
//
//
//                       National Institute Of Standards and Technology
//                                     DTS Version 1.0
//         
//                                   Element Interface
//
// Written by: Carmelo Montanez
// Modified by:  Mary Brady
//
// Ported to System.Xml by: Mizrahi Rafael rafim@mainsoft.com
// Mainsoft Corporation (c) 2003-2004
//**************************************************************************
using System;
using System.Xml;

using nist_dom;
using NUnit.Framework;

namespace nist_dom.fundamental
{
    [TestFixture]
    public class ElementTest
    {
        public static int i = 2;
/*
        public testResults[] RunTests()
        {
            testResults[] tests = new testResults[] {core0001E(), core0002E(), core0003E(),core0004E(),
                                                        core0005E(), core0006E(), core0007E(), core0008E(),
                                                        core0009E(), core0010E(), core0011E(), core0012E(),
                                                        core0013E(), core0014E(), core0015E(), core0016E(),
                                                        core0017E(), core0018E(), core0019E(), core0020E(),
                                                        core0021E(), core0022E(), core0023E(), core0024E(),
                                                        core0025E(), core0026E(), core0027E(), core0028E(),
                                                        core0029E(), core0030E()};
  
            return tests;
        }
*/
        //------------------------ test case core-0001E ------------------------
        //
        // Testing feature - Elements may have attributes associated with them. 
        //
        // Testing approach - Retrieve the first attribute from the last child of
        //                    the first employee and examine its "specified"
        //                    attribute.  This test is only intended to show
        //                    that Elements can actually have attributes.
        //                    This test uses the "getNamedItem(name)" method from 
        //                    the NamedNodeMap interface.
        //
        // Semantic Requirements: 1
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0001E()
        {
            string computedValue = "0";//0
            string expectedValue = "True";//true
            System.Xml.XmlNode addressElement = null;
            System.Xml.XmlAttributeCollection attrList = null;
            System.Xml.XmlAttribute domesticAttr = null;

            testResults results = new testResults("Core0001E");
            try
            {
                results.description = "Element nodes may have associated attributes.";
                //
                // Retrieve the "address" element from the first employee.
                //
                addressElement = util.nodeObject(util.FIRST,util.SIXTH);
                //
                // Access its "domestic" attribute by creating a list of all attributes
                // and then retrieving the desired attribute from the list by name. 
                //
                attrList = addressElement.Attributes;//.node.
                domesticAttr = (System.Xml.XmlAttribute)attrList.GetNamedItem("domestic");
                //
                // Access its "specified" attribute.
                //
                computedValue = domesticAttr.Specified.ToString();
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results 
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            Assert.AreEqual (results.expected, results.actual);
        }
        //------------------------ End test case core-0001E --------------------------
        //
        //------------------------ test case core-0002E ------------------------
        //
        // Testing feature - The generic Attribute "attributes" (Node interface) may 
        //                   be used to retrieve the set of all attributes of an
        //                   element.
        //
        // Testing approach - Create a list of all the attributes of the last child of
        //                    of the first employee by using the generic "attributes"
        //                    attribute from the Node interface.  Further the length
        //                    of the attribute list is examined.  This test makes
        //                    use of the "Count" attribute from the NameNodeMap 
        //                    interface.
        //
        // Semantic Requirements: 1, 2 
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0002E()
        {
            string computedValue = "";
            string expectedValue = "2";
            System.Xml.XmlNode addressElement = null;
            System.Xml.XmlAttributeCollection attrList = null;

            testResults results = new testResults("Core0002E");
            try
            {
                results.description = "The generic \"attributes\" (from the Node interface) may " +
                    "be used to retrieve the set of all attributes of an element.";
                //
                // Retrieve the "address" element from the first employee.
                //
                addressElement = util.nodeObject(util.FIRST,util.SIXTH);
                //
                // Access its attributes list.
                //
                attrList = addressElement.Attributes;
                //
                // Access its "length" attribute.
                //
                computedValue = attrList.Count.ToString();
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0002E --------------------------
        //
        //-------------------------- test case core-0003E ----------------------------
        //
        // Testing feature - The "tagName" attribute contains the name of the
        //                   element. 
        //
        // Testing approach - Retrieve the third child of the second employee and
        //                    examine its "tagName" attribute.  It should return a 
        //                    string containing the name of the element ("position",
        //                    in this case). 
        //
        // Semantic Requirements: 3 
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0003E()
        {
            string computedValue = "";
            string expectedValue = "position";
            System.Xml.XmlNode positionElement = null;

            testResults results = new testResults("Core0003E");
            try
            {
                results.description = "The \"tagName\" of an Element contains the " +
                    "element's name.";
                //
                // Access its third child of the second employee.
                //
                positionElement = util.nodeObject(util.SECOND,util.THIRD);
                //
                // Access its "tagName" attribute.
                //
                computedValue = positionElement.Name;//tagName;//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0003E --------------------------
        //
        //-------------------------- test case core-0004E ----------------------------
        //
        // Testing feature - The "getAttribute(name)" method returns an attribute value
        //                   by name. 
        //
        // Testing approach - Retrieve the the last child of the third employee, then  
        //                    invoke its "getAttribute(name)" method.  It should
        //                    return the value of the attribute("No", in this case).
        //
        // Semantic Requirements: 1, 4
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0004E()
        {
            string computedValue = "";
            string expectedValue = "No";
            System.Xml.XmlElement addressElement = null;

            testResults results = new testResults("Core0004E");
            try
            {
                results.description = "The \"getAttribute(name)\" method of an Element returns " +
                    "the value of an attribute by name.";
                //
                // Retrieve the targeted data. 
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);
                computedValue = addressElement.GetAttribute("street");//addressElement.node.GetAttribute("street");
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0004E --------------------------
        //
        //-------------------------- test case core-0005E ----------------------------
        //
        // Testing feature - The "getAttribute(name)" method returns an empty
        //                   string if no value was assigned to an attribute and
        //                   no default value was given in the DTD file.
        //
        // Testing approach - Retrieve the the last child of the last employee, then
        //                    invoke its "getAttribute(name)" method, where "name" is an
        //                    attribute with no specified or DTD default value.  The
        //                    "getAttribute(name)" method should return the empty
        //                    string.  This method makes use of the 
        //                    "createAttribute(newAttr)" method from the Document
        //                    interface.
        //
        // Semantic Requirements: 1, 4, 5 
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0005E()
        {
            string computedValue = "";
            string expectedValue = "";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute newAttribute = null;


            testResults results = new testResults("Core0005E");
            try
            {
                results.description = "The \"getAttribute(name)\" method of an Element returns " +
                    "the empty string if the attribue does not have a default " +
                    "or specified value.";
                //
                // Access the sixth child of the last employee.
                //
                newAttribute = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"district");
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FOURTH,util.SIXTH);
                //
                // Invoke its "setAttributeNode(newAttr)" method where
                // newAttr = "newAttribute".  Since no value was specified or given
                // by default, the value returned by the "getAttribute(name)" method 
                // should be the empty string.
                //
                addressElement.SetAttributeNode(newAttribute);//.node.
                computedValue = addressElement.GetAttribute("district");//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0005E --------------------------
        //
        //-------------------------- test case core-0006E ----------------------------
        //
        // Testing feature - The "setAttribute(name,value)" method adds a new attribute
        //                   to the Element.
        //
        // Testing approach - Retrieve the last child of the last employee, then
        //                    add an attribute to it by invoking its 
        //                    "setAttribute(name,value)" method.  It should create 
        //                    a "name" attribute with an assigned value equal to 
        //                    "value".  
        //
        // Semantic Requirements: 1, 4, 6 
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0006E()
        {
            string computedValue = "";
            System.Xml.XmlElement addressElement = null;
            string name = "district";
            string expectedValue = "dallas"; 


            testResults results = new testResults("Core0006E");
            try
            {
                results.description = "The \"setAttribute(name,value)\" method of an Element " +
                    "creates an new \"name\" attribute whose value is equal to \"value\".";
                //
                // Access the last child of the last employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FIFTH,util.SIXTH);
                //
                // Invoke its "setAttribute(name,value)" method and create a new attribute
                //
                addressElement.SetAttribute(name,expectedValue);//.node.
                //
                // This Element should now have a new attribute that we can be retrieved
                // by name. 
                //
                computedValue = addressElement.GetAttribute(name);//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0006E --------------------------
        //
        //-------------------------- test case core-0007E ----------------------------
        //
        // Testing feature - The "setAttribute(name,value)" method adds a new attribute
        //                   to the Element.  If the "name" is already present, then
        //                   its value should be changed to the new one of the
        //                   "value" parameter.
        //
        // Testing approach - Retrieve the last child of the fourth employee,
        //                    then add an attribute to it by invoking its
        //                    "setAttribute(name,value)" method.  Since the name 
        //                    of the used attribute ("street") is already present
        //                    in this element, then its value should be
        //                    changed to the new one of the "value" parameter.
        //
        // Semantic Requirements: 1, 4, 7 
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0007E()
        {
            string computedValue = "";
            string expectedValue = "Neither";
            System.Xml.XmlElement addressElement = null;

            testResults results = new testResults("Core0007E");
            try
            {
                results.description = "The \"setAttribute(name,value)\" method of an Element " +
                    "where the \"name\" attribute is already present in this Element.";
                //
                // Access the sixth child of the fourth employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FOURTH,util.SIXTH);
                //
                // Invoke its "setAttribute(name,value)" method where name = "street"
                // and value = "Neither".
                //
                addressElement.SetAttribute("street","Neither");//.node.
                //
                // The "street" attribute should now have a value of "Neither" 
                //
                computedValue = addressElement.GetAttribute("street");//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0007E --------------------------
        //
        //-------------------------- test case core-0008E ----------------------------
        //
        // Testing feature - The "removeAttribute(name)" removes an attribute
        //                   by name.  If the removed attribute is known to have a
        //                   default value, an attribute immediately appears 
        //                   containing the default value.
        //
        // Testing approach - Retrieve the attribute named "street" from the last
        //                    child of the fourth employee, then remove the "street"
        //                    attribute by invoking its "removeAttribute(name) method.
        //                    The "street" attribute has a default value defined in the 
        //                    DTD file, that value should immediately replace the 
        //                    old value.   
        //
        // Semantic Requirements: 1, 8 
        //
        //----------------------------------------------------------------------------

        [Test]
        [Ignore(".NET DOM implementation does not match W3C DOM specification.")]
	public void core0008E()
        {
            string computedValue = "";
            string expectedValue = "Yes";
            System.Xml.XmlElement addressElement = null;
            string streetAttr = "";

            testResults results = new testResults("Core0008E");
            try
            {
                results.description = "The \"removeAttribute(name)\" method of an Element " +
                    "removes the \"name\" attribute and restores any " +
                    "known default values.";
                //
                // Access the last child of the fourth employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FOURTH,util.SIXTH);
                //
                // Invoke its "removeAttribute(name)" method where name = "street"
                //
                addressElement.RemoveAttribute("street");//.node.
                //
                // Now access that attribute.
                //
                streetAttr = addressElement.GetAttribute("street");//.node.
                //
                // The "street" attribute should now have a default values 
                //
                computedValue = addressElement.GetAttribute("street");//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0008E --------------------------
        //
        //-------------------------- test case core-0009E ----------------------------
        //
        // Testing feature - The "getAttributeNode(name)" retrieves an attribute
        //                   node by name.  
        //
        // Testing approach - Retrieve the attribute named "domestic" from the last 
        //                    child of the first employee.  Since the method returns
        //                    an Attr object, its name attribute can be examined to 
        //                    ensure the proper attribute was retrieved.
        //
        // Semantic Requirements: 1, 9 
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0009E()
        {
            string computedValue = "";
            string expectedValue = "domestic";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute domesticAttrNode = null;

            testResults results = new testResults("Core0009E");
            try
            {
                results.description = "The \"getAttributeNode(name)\" method of an Element " +
                    "returns the \"name\" Attr node.";
                //
                // Access the last child of the first employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);
                //
                // Invoke its "getAttributeNode(name)" method where name = "domestic"
                // and create an Attr object.  
                //
                domesticAttrNode = addressElement.GetAttributeNode("domestic");//.node.
                //
                // Now access the "name" attribute of that Attr node.  Since the "domestic"
                // attribute was retrieved, the name of the Attr node should also be
                // "domestic". 
                //
                computedValue = domesticAttrNode.Name;
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0009E --------------------------
        //
        //-------------------------- test case core-00010E ----------------------------
        //
        // Testing feature - The "getAttributeNode(name)" retrieves an attribute
        //                   node by name.  It should return null if the "name" 
        //                   attribute does not exist.
        //
        // Testing approach - Retrieve the last child of the first employee and 
        //                    attempt to retrieve a non-existing attribute.
        //                    The method should return null.  The non-existing
        //                    attribute to be used is "invalidAttribute".
        //
        // Semantic Requirements: 1, 10
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0010E()
        {
            object computedValue = null;
            object expectedValue = null;
            System.Xml.XmlElement addressElement = null;

            testResults results = new testResults("Core0010E");
            try
            {
                results.description = "The \"getAttributeNode(name)\" method returns null " +
                    "if the \"name\" attribute does not exist.";
                //
                // Access the last child of the first employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);
                //
                // Invoke its "getAttributeNode(name)" method where name = "invalidAttribute"
                // This should result in a null value being returned by the method.
                //
                computedValue = addressElement.GetAttributeNode("invalidAttribute");//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = (expectedValue == null).ToString();
            results.actual = (computedValue == null).ToString();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0010E --------------------------
        //
        //-------------------------- test case core-0011E ----------------------------
        //
        // Testing feature - The "setAttributeNode(newAttr)" adds a new attribute
        //                   to the Element.
        //
        // Testing approach - Retrieve the last child of the first employee and
        //                    add a new attribute node to it by invoking its 
        //                    "setAttributeNode(newAttr)" method.  This test makes 
        //                    use of the "createAttribute(name)" method from the 
        //                    Document interface.
        //
        // Semantic Requirements: 1, 11
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0011E()
        {
            string computedValue = "";
            string expectedValue = "";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute newAttribute = null;
            string name = "district";

            testResults results = new testResults("Core0011E");
            try
            {
                results.description = "The \"setAttributeNode(newAttr)\" method adds a new " +
                    "attribute node to the element.";
                //
                // Access the last child of the first employee.
                //
                newAttribute = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,name);
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);
                //
                // Invoke its "setAttributeNode(newAttr)" method where 
                // newAttr = "newAttribute".  Since no value was specified or given 
                // by default, its value should be the empty string. 
                //
                addressElement.SetAttributeNode(newAttribute);//.node.
                computedValue = addressElement.GetAttribute(name);//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0011E --------------------------
        //
        //-------------------------- test case core-00012E ----------------------------
        //
        // Testing feature - The "setAttributeNode(newAttr)" method adds a new attribute
        //                   to the Element.  If the "newAttr" Attr node is already
        //                   present in this element, it should replace the existing
        //                   one.
        //
        // Testing approach - Retrieve the last child of the third employee and
        //                    add a new attribute node to it by invoking its
        //                    "setAttributeNode(newAttr)" method.  The new attribute 
        //                    node to be added is "street", which is already
        //                    present in this element.  The method should replace the 
        //                    existing Attr node with the new one.  This test make use 
        //                    of the "createAttribute(name)" method from the Document
        //                    interface.
        //
        // Semantic Requirements: 1, 12
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0012E()
        {
            string computedValue = "";
            string expectedValue = "";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute newAttribute = null;

            testResults results = new testResults("Core0012E");
            try
            {
                results.description = "The \"setAttributeNode(newAttr)\" method when " +
                    "the \"newAttr\" node is already part of this " +
                    "element.  The existing attribute node should be "+
                    "replaced with the new one."; 
                //
                // Access the last child of the third employee.
                //
                newAttribute = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"street");  
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);
                //
                // Invoke its "setAttributeNode(newAttr)" method where 
                // newAttr = "newAttribute".  That attribute is already part of this 
                // element.  The existing attribute should be replaced with the new one 
                //    (newAttribute).
                //
                addressElement.SetAttributeNode(newAttribute);//.node.
                computedValue = addressElement.GetAttribute("street");//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0012E --------------------------
        //
        //-------------------------- test case core-00013E ----------------------------
        //
        // Testing feature - If The "setAttributeNode(newAttr)" method replaces 
        //                   an existing Attr node with the same name, then it 
        //                   should return the previously existing Attr node.
        //
        // Testing approach - Retrieve the last child of the third employee and add
        //                    a new attribute node to it.  The new attribute node to 
        //                    be added is "street", which is already present in this
        //                    Element.  The method should return the existing Attr 
        //                    node(old "street" Attr).  This test make use of the 
        //                    "createAttribute(name)" method from the Document 
        //                    interface.
        //
        // Semantic Requirements: 1, 13
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0013E()
        {
            string computedValue = "";
            string expectedValue = "No";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute oldStreetAttribute = null;
            System.Xml.XmlAttribute newAttribute = null;

            testResults results = new testResults("Core0013E");
            try
            {
                results.description = "The \"setAttributeNode(newAttr)\" method when the " +
                    "\"newAttr\" attribute node is already present in " +
                    "this element.  The method should return the previously " +
                    "existing Attr node."; 
                //
                // Access the last child of the third employee.
                //
                newAttribute = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"street");
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);
                //
                // Invoke its "setAttributeNode(newAttr)" method where 
                // newAttr was just created with the same name as an already existing
                // attribute("street"). The existing attribute should be replaced with the 
                // new one and the method should return the existing "street" Attr node.  
                //
                oldStreetAttribute = addressElement.SetAttributeNode(newAttribute);//.node.
                //
                // The "oldStreetAttribute" now contains the old Attr node and its 
                // "value" attribute should be available for examination.
                //
                computedValue = oldStreetAttribute.Value;
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0013E --------------------------
        //
        //-------------------------- test case core-00014E ----------------------------
        //
        // Testing feature - The "setAttributeNode(newAttr)" method returns the 
        //                   null value if no previously existing Attr node with the 
        //                   same name was replaced.
        //
        // Testing approach - Retrieve the last child of the third and add a new 
        //                    attribute node to it.  The new attribute node to be 
        //                    added is "district", which is not part of this Element.  
        //                    The method should return the null value.  This test makes
        //                    use of the "createAttribute(name)" method from the
        //                    Document interface.
        //
        // Semantic Requirements: 1, 15
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0014E()
        {
            object computedValue = null;
            object expectedValue = null;
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute newAttribute = null;

            testResults results = new testResults("Core0014E");
            try
            {
                results.description = "The \"setAttributeNode(newAttr)\" method returns a " +
                    "null value if no previously existing Attr node was replaced.";
                //
                // Access the sixth child of the third employee.
                //
                newAttribute = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"district");
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);
                //
                // Invoke its "setAttributeNode(newAttr)" method where name = "newAttribute".
                // This attribute is not part of this element.  The method should add the
                // new Attribute and return a null value.
                //
                computedValue = addressElement.SetAttributeNode(newAttribute);//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = (expectedValue == null).ToString();
            results.actual = (computedValue == null).ToString();

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0014E --------------------------
        //
        //-------------------------- test case core-00015E ----------------------------
        //
        // Testing feature - The "removeAttributeNode(oldAttr)" method removes the 
        //                   specified attribute. 
        //
        // Testing approach - Retrieve the last child of the third employee, add
        //                    a new "district" node to it and the try to remove it. 
        //                    To verify that the node was removed this test uses the 
        //                    "getNamedItem(name)" from the NamedNodeMap interface.   
        //                    This test also makes use of the "attributes" attribute 
        //                    from the Node interface.
        //
        // Semantic Requirements: 1, 14
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0015E()
        {
            object computedValue = null;
            object expectedValue = null;
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttributeCollection attrList = null;
            System.Xml.XmlAttribute newAttribute = null;
            newAttribute = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"district");

            testResults results = new testResults("Core0015E");
            try
            {
                results.description = "The \"removeAttributeNode(oldAttr)\" method removes the " +
                    "specified attribute node.";
                //
                // Access the sixth child of the third employee and add the new
                // attribute to it.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);
                addressElement.SetAttributeNode(newAttribute);//.node.
                //
                // Invoke its "removeAttributeNode(oldAttr)" method where 
                // name = "newAttribute" and remove that attribute node.
                //
                addressElement.RemoveAttributeNode(newAttribute);//.node.
                //
                // To ensure that the "district" attribute was indeed removed, a listing
                // of all attributes is created by invoking the "attributes" attribute
                // of "addressElement".  After the list is created, we attempt to
                // retrieve the "district" element from the list.  A null value should
                // be return in its place.
                //
                attrList = addressElement.Attributes;
                computedValue = attrList.GetNamedItem("district");
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = (expectedValue == null).ToString();
            results.actual = (computedValue == null).ToString();

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0015E --------------------------
        //
        //-------------------------- test case core-00016E ----------------------------
        //
        // Testing feature - The "removeAttributeNode(oldAttr)" method removes the 
        //                   specified attribute node and restore any default values.
        //
        // Testing approach - Retrieve the last child of the third employee and
        //                    remove its "street" Attr node.  Since this node has
        //                    default value defined in the DTD file, that default
        //                    value should immediately be the new value.  
        //
        // Semantic Requirements: 1, 15
        //
        //----------------------------------------------------------------------------

        [Test]
        [Ignore(".NET DOM implementation does not match W3C DOM specification.")]
	public void core0016E()
        {
            string computedValue = "";
            string expectedValue = "Yes";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute streetAttr = null;
            //System.Xml.XmlNode thirdEmployee = null;

            testResults results = new testResults("Core0016E");
            try
            {
                results.description = "The \"removeAttributeNode(oldAttr)\" method removes the " +
                    "specified attribute node and restores any default values.";
                //
                // Access the sixth child of the third employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);
                //
                // Create an instance of an Attr object by retrieving the "street"
                // attribute node, invoke its "removeAttributeNode(oldAttr)" method
                // where name = "streetAttr" and remove that attribute node.  Note that 
                // "the removeAttributeNode(oldAttr)" takes an Attr object as its 
                // parameter, that is why an Attr object (named "street") is first created. 
                //
                streetAttr = addressElement.GetAttributeNode("street");//.node.
                addressElement.RemoveAttributeNode(streetAttr);//.node.
                //
                // Since there is a default value defined for the "street" attribute, it
                // should immediately be the new value for that attribute. 
                //
                computedValue = addressElement.GetAttribute("street");//.node.
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0016E --------------------------
        //
        //-------------------------- test case core-00017E ----------------------------
        //
        // Testing feature - The "removeAttributeNode(oldAttr)" method returns the 
        //                   node that was removed.
        //
        // Testing approach - Retrieve the last child of the third employee and 
        //                    remove its "street" Attr node.  The method should 
        //                    return the old attribute node.
        //
        // Semantic Requirements: 1, 16
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0017E()
        {
            string computedValue = "";
            string expectedValue = "No";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute streetAttr = null;
            System.Xml.XmlAttribute oldStreetAttribute = null;

            testResults results = new testResults("Core0017E");
            try
            {
                results.description = "The \"removeAttributeNode(oldAttr)\" method returns the "+
                    "removed attribute node.";
                //
                // Access the sixth child of the third employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.THIRD,util.SIXTH);

                // create an instance of an Attr object by retrieving the "street"
                // attribute node, invoke its "removeAttributeNode(oldAttr)" method
                // where name = "streetAttr" and remove that attribute node.  Note that
                // "the removeAttributeNode(oldAttr)" takes an Attr object as its
                // parameter, that is why an Attr object (named "street") is first created.
                //
                streetAttr = addressElement.GetAttributeNode("street");//.node.
                oldStreetAttribute = addressElement.RemoveAttributeNode(streetAttr);//.node.
                //
                // The method should return the removed attribute node.  Its value can then
                // be examined.
                //
                computedValue = oldStreetAttribute.Value;
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0017E --------------------------
        //
        //-------------------------- test case core-00018E ----------------------------
        //
        // Testing feature - The "getElementsByTagName(name)" method returns a list 
        //                   of all descendant Elements with the given tag name.
        //
        // Testing approach - Get a listing of all the descendant elements of the
        //                    root element using the string "employee" as the tag
        //                    name.  The  method should return a Node list of length 
        //                    equal to 5.  This test makes use of the "length" 
        //                    attribute from the NodeList interface.
        //
        // Semantic Requirements: 1, 17
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0018E()
        {
            int computedValue = 0;
            int expectedValue = 5;
            System.Xml.XmlNodeList employeeList = null;
            System.Xml.XmlElement docElement = null;

            testResults results = new testResults("Core0018E");

            results.description = "The \"getElementsByTagName(name)\" method returns a "+
                "NodeList of all descendant elements with the given " +
                "tag name(method returning a non-empty list)";
            //
            // get a listing of all the elements that match the tag "employee".
            //
            docElement = util.getRootNode();
            employeeList = docElement.GetElementsByTagName("employee");
            //
            // The method should return a NodeList whose length can then be examined. 
            //
            computedValue = employeeList.Count;
            //
            // Write out results
            //
            results.expected = expectedValue.ToString();
            results.actual = computedValue.ToString();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0018E --------------------------
        //
        //-------------------------- test case core-00019E ----------------------------
        //
        // Testing feature - The "getElementsByTagName(name)" returns a list of all
        //                   descendant Elements with the given tag name.  Test
        //                   for an empty list.
        //
        // Testing approach - Get a listing of all the descendant elements of the
        //                    root element using the string "noMatches" as the tag
        //                    name.  The  method should return a NodeList of length
        //                    equal to 0 since no descendant elements match the given
        //                    tag name.  This test makes use of the "length" attribute
        //                    from the NodeList interface.
        //
        // Semantic Requirements: 1, 17
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0019E()
        {
            int computedValue = 0;
            int expectedValue = 0;
            System.Xml.XmlNodeList employeeList = null;
            System.Xml.XmlElement docElement = null;

            testResults results = new testResults("Core0019E");

            results.description = "The \"getElementsByTagName(name)\" method returns a "+
                "NodeList of all descendant elements with the given " +
                "tag name (method returns an empty list)";
            //
            // get a listing of all the elements that match the tag "noMatch".
            //
            docElement = util.getRootNode();
            employeeList = docElement.GetElementsByTagName("noMatch");
            //
            // The method should return a NodeList whose length can then be examined.
            //
            computedValue = employeeList.Count;
            //
            // Write out results
            //
            results.expected = expectedValue.ToString();
            results.actual = computedValue.ToString();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0019E --------------------------
        //
        //-------------------------- test case core-00020E ----------------------------
        //
        // Testing feature - The "getElementsByTagName(name)" returns a list of all
        //                   descendant Elements in the order the children were
        //                   encountered in a pre order traversal of the element tree.
        //
        // Testing approach - Get a listing of all the descendant elements of the
        //                    root node using the string "employee" as the tag
        //                    name.  The  method should return a Node list of length
        //                    equal to 5 in the order the children were encountered.
        //                    Item number four in the list is accessed using a 
        //                    subscript.  Item number four is itself an Element node
        //                    with children and whose first child should be 
        //                    "employeeId".
        //
        // Semantic Requirements: 1, 18 
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0020E()
        {
            string computedValue = "";
            string expectedValue = "employeeId";
            System.Xml.XmlNodeList employeeList = null;
            System.Xml.XmlNode fourthEmployee = null;
            System.Xml.XmlElement docElement = null;

            testResults results = new testResults("Core0020E");

            results.description = "The \"getElementsByTagName(name)\" returns a NodeList " +
                "of all descendant elements in the order the " +
                "children were encountered in a preorder traversal " +
                "of the element tree.";
            //
            // get a listing of all the elements that match the tag "employee".
            //
            docElement = util.getRootNode();
            employeeList = docElement.GetElementsByTagName("employee");

            //
            // The method should return a NodeList of the children in the order the 
            // children were encountered.  Since "employeeList" is a NodeList we should 
            // be able to access its elements by using a subscript.  Item number four 
            // is itself an Element node with six children and the first child 
            // is "employeeId". 
            //
            fourthEmployee = employeeList.Item(util.FOURTH);
            computedValue = fourthEmployee.FirstChild.Name;
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0020E --------------------------
        //
        //-------------------------- test case core-00021E ----------------------------
        //
        // Testing feature - The "getElementsByTagName(name)" method may use the 
        //                   special value "*" to match all the tags in the element 
        //                   tree. 
        //
        // Testing approach - Get a listing of all the descendant elements of the
        //                    last employee by using the special value of "*".  The 
        //                    method should return all of the descendant children
        //                    (total of 6) in the order the children were encountered.
        //
        // Semantic Requirements: 1, 19 
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0021E()
        {
            string computedValue = "";
            string expectedValue = "employeeId name position salary gender address ";
            System.Xml.XmlNodeList elementList = null;
            System.Xml.XmlElement lastEmployee = null;

            testResults results = new testResults("Core0021E");

            results.description = "The \"getElementsByTagName(name)\" method may use the " +
                "special value \"*\" to match all the tags in the " +
                "element tree.";
            //
            // get a listing of all the descendant elements of the last employee by using
            // the special value of "*".
            //
            lastEmployee = (System.Xml.XmlElement)util.nodeObject(util.FIFTH,-1);
            elementList = lastEmployee.GetElementsByTagName("*");//.node.
            //
            // Traverse the list.
            //
            for (int index = 0;index <= elementList.Count - 1;index++)
                computedValue += elementList.Item(index).Name+" ";
            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0021E --------------------------
        //
        //-------------------------- test case core-00022E ----------------------------
        //
        // Testing feature - The "normalize()" method puts all the nodes in the
        //                   full depth of the sub-tree underneath this element
        //                   into a "normal" form.
        //
        // Testing approach - Retrieve the third employee and access its second 
        //                    child.  This child contains a block of text that spread
        //                    accross multiple lines.  The content of the "name" 
        //                    child should be parsed and treated as a single Text node.
        //
        // Semantic Requirements: 1, 20
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0022E()
        {
            string computedValue = "";
            string expectedValue = "Roger\n Jones";
            System.Xml.XmlNode idElement = null;
            System.Xml.XmlNode textNode = null;

            testResults results = new testResults("Core0022E");
            try
            {
                results.description = "The \"normalize()\" method puts all the nodes in the " +
                    "full depth of the sub-tree of this element into a normal form.";
                //
                // The "normalize() method should combine all the contiguous blocks of text
                // and form a single "Text" node.  The "nodeValue" of that final Text node
                // should be the combination of all continuos blocks of text that do not
                // contain any markup language. 
                //
                idElement = util.nodeObject(util.THIRD,util.SECOND);
                idElement.Normalize();//.node.
                textNode = idElement.LastChild;//.node.
                //
                // text should be in normal form now
                //
                computedValue = textNode.Value;
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            //
            // Write out results
            //
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0022E --------------------------
        //
        //-------------------------- test case core-00023E ---------------------------
        //
        // Testing feature - The "setAttribute(name,value)" method raises an
        //                   INVALID_CHARACTER_ERR Exception if the specified  
        //                   name contains an invalid character.
        //
        // Testing approach - Retrieve the last child of the first employee
        //                    and call its "setAttribute(name,value)" method with
        //                    "name" containing an invalid character.
        //
        // Semantic Requirements: 1, 21
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0023E()
        {
            string computedValue = "";
            System.Xml.XmlElement addressElement = null;
            string expectedValue = "System.ArgumentException";

            testResults results = new testResults("Core0023E");
            try
            {
                results.description = "The \"setAttribute(name,value)\" method raises an " +
                    "ArgumentException if the specified " +
                    "name contains an invalid character.";
                //
                // Access the "address" element of the first employee. 
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FIRST,util.SIXTH);
                //
                // Attempt to set an attribute with an invalid character in its name.
                //
                try 
                {
                    addressElement.SetAttribute("invalid^Name","thisValue");//.node.
                }
                catch(System.Exception ex) 
                {
                    computedValue = ex.GetType().ToString(); 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }

            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0023E --------------------------
        //
        //-------------------------- test case core-0024E ----------------------------
        //
        // Testing feature - The "setAttribute(name,value)" method raises a
        //                   NO_MODIFICATION_ALLOWED_ERR Exception if this 
        //                   node is readonly.
        //
        // Testing approach - Retrieve the Element node inside the Entity node 
        //                    named "ent4" and attempt to set an attribute for
        //                    it.  Descendants of Entity nodes are readonly nodes
        //                    and therefore the desired exception should be raised.
        //
        // Semantic Requirements: 22
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0024E()
        {
            string computedValue = "";
            System.Xml.XmlEntity entityNode = null;
            System.Xml.XmlElement entityDesc = null;
            string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;

            testResults results = new testResults("Core0024E");
            try
            {
                results.description = "The \"setAttribute(name,value)\" method raises a " +
                    "NO_MODIFICATION_ALLOWED_ERR Exception if the node is readonly.";

                //
                // Retreive the targeted data.
                //
                entityNode = util.getEntity("ent4");
                entityDesc = (System.Xml.XmlElement)entityNode.FirstChild;
                //
                // Attempt to set an attribute for a readonly node should raise an exception.
                //
                try 
                {
                    entityDesc.SetAttribute("newAttribute","thisValue");
                }
                catch(System.Exception ex) 
                {
                    computedValue = ex.GetType ().FullName; 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0024E --------------------------
        //
        //-------------------------- test case core-00025E ---------------------------
        //
        // Testing feature - The "removeAttribute(name)" method raises a
        //                   NO_MODIFICATION_ALLOWED_ERR Exception if this
        //                   node is readonly.
        //
        // Testing approach - Retrieve the Element node inside the Entity node
        //                    named "ent4" and attempt to remove an attribute from
        //                    it.  Descendants of Entity nodes are readonly nodes
        //                    and therefore the desired exception should be raised.
        //
        // Semantic Requirements: 23
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0025E()
        {
            string computedValue = "";
            System.Xml.XmlEntity entityNode = null;
            System.Xml.XmlElement entityDesc = null;
            string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;

            testResults results = new testResults("Core0025E");
            try
            {
                results.description = "The \"removeAttribute(name)\" method raises a " +
                    "NO_MODIFICATION_ALLOWED_ERR Exception if the node is readonly.";
                //
                // Retrieve the targeted data.
                //
                entityNode = util.getEntity("ent4");
                entityDesc = (System.Xml.XmlElement)entityNode.FirstChild;
                //
                // Attempt to set an attribute for a readonly node should raise an exception.
                //
                try 
                {
                    entityDesc.RemoveAttribute("attr1");
                }
                catch(System.Exception ex) 
                {
                    computedValue = ex.GetType ().FullName; 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0025E --------------------------
        //
        //-------------------------- test case core-00026E ---------------------------
        //
        // Testing feature - The "setAttributeNode(newAttr)" method raises a
        //                   NO_MODIFICATION_ALLOWED_ERR Exception if this
        //                   node is readonly.
        //
        // Testing approach - Retrieve the Element node inside the Entity node
        //                    named "ent4" and attempt to add a newly created Attr 
        //                    node to it.  Descendants of Entity nodes are readonly 
        //                    nodes and therefore the desired exception should be
        //                    raised.
        //
        // Semantic Requirements: 24
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0026E()
        {
            string computedValue = "";
            System.Xml.XmlEntity entityNode = null;
            System.Xml.XmlElement entityDesc = null;
            System.Xml.XmlAttribute newAttr = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"newAttribute");
            string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;

            testResults results = new testResults("Core0026E");
            try
            {
                results.description = "The \"setAttributeNode(newAttr)\" method raises a " +
                    "NO_MODIFICATION_ALLOWED_ERR Exception if the node is readonly.";
                //
                // Retrieve targeted data
                //
                entityNode = util.getEntity("ent4");
                entityDesc = (System.Xml.XmlElement)entityNode.FirstChild;
                //
                // Attempt to set an attribute for a readonly node should raise an exception.
                //
                try 
                {
                    entityDesc.SetAttributeNode(newAttr);
                }
                catch(System.Exception ex) 
                {
                    computedValue = ex.GetType ().FullName; 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0026E --------------------------
        //
        //-------------------------- test case core-00027E ---------------------------
        //
        // Testing feature - The "removeAttributeNode(newAttr)" method raises a
        //                   NO_MODIFICATION_ALLOWED_ERR Exception if this
        //                   node is readonly.
        //
        // Testing approach - Retrieve the Element node inside the Entity node
        //                    named "ent4" and attempt to remove its "attr1"
        //                    attribute.  Descendants of Entity nodes are readonly
        //                    nodes and therefore the desired exception should be
        //                    raised.
        //
        // Semantic Requirements: 25
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0027E()
        {
            string computedValue = "";
            System.Xml.XmlEntity entityNode = null;
            System.Xml.XmlElement entityDesc = null;
            System.Xml.XmlAttribute oldAttribute = null;
            string expectedValue = "System.ArgumentException";//util.NO_MODIFICATION_ALLOWED_ERR;

            testResults results = new testResults("Core0027E");
            try
            {
                results.description = "The \"removeAttributeNode(newAttr)\" method raises a " +
                    "NO_MODIFICATION_ALLOWED_ERR Exception if the node is readonly.";
                //
                // Get an instance of an attribute node and retrieve targeted data.
                //
                entityNode = util.getEntity("ent4");
                entityDesc = (System.Xml.XmlElement)entityNode.FirstChild;
                oldAttribute = ((System.Xml.XmlElement)entityNode.FirstChild).GetAttributeNode("attr1");
                //
                // Attempt to set remove an attribute node from a readonly node (lastChild).  
                // Should raise an exception. 
                //
                try 
                {
                    entityDesc.RemoveAttributeNode(oldAttribute);
                }
                catch(System.Exception ex) 
                {
                    computedValue = ex.GetType ().FullName; 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0027E --------------------------
        //
        //-------------------------- test case core-00028E ---------------------------
        //
        // Testing feature - The "setAttributeNode(newAttr)" method raises a
        //                   System.ArgumentException Exception if the "newAttr" was 
        //                   created from a different document than the one that
        //                   created this document. 
        //
        // Testing approach - Retrieve the last employee and attempt to set
        //                    a new attribute node for its "employee" element.
        //                    The new attribute was created from a document 
        //                    other than the one that crated this element,
        //                    therefore the desired exception should be raised. 
        //                    This test uses the "createAttribute(newAttr)" method
        //                    from the Document interface.
        //
        // Semantic Requirements: 26
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0028E()
        {
            System.Xml.XmlElement addressElement = null;
            string computedValue = "";
            System.Xml.XmlAttribute newAttr = null;
            string expectedValue = "System.ArgumentException";

            testResults results = new testResults("Core0028E");
            try
            {
                results.description = "The \"setAttributeNode(newAttr)\" method raises a " +
                    "System.ArgumentException Exception if \"newAttr\" was created " +
                    "from a different document than the one who created this node.";
                //
                // Access the address Element of the last employee and attempt to set 
                // a new attribute node. 
                //
                newAttr = util.getOtherDOMDocument().CreateAttribute("newAttribute");
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FIFTH,util.SIXTH);
                //
                // The new attribute was created from a different document and therefore 
                // an exception should be raised.
                //
                try 
                {
                    addressElement.SetAttributeNode(newAttr);//.node.
                }
                catch(System.Exception ex) 
                {
                    computedValue = ex.GetType().ToString(); 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0028E --------------------------
        //
        //-------------------------- test case core-00029E ---------------------------
        //
        // Testing feature - The "setAttributeNode(newAttr)" method raises an
        //                   InvalidOperationException if the "newAttr"
        //                   attribute is already an attribute of another element. 
        //
        // Testing approach - Retrieve the last employee and attempt to set an
        //                    attribute node to one of its children that
        //                    already exist in another children.  The attribute
        //                    node used is "street", which already exist in the
        //                    "address" element.  An instance of that attribute
        //                    node is first retrived from the "address" element and
        //                    then attempted to be set in the "employeeId" element.  
        //                    This should cause the intended exception to be raised.
        //
        // Semantic Requirements: 27
        //
        //----------------------------------------------------------------------------

        [Test]
	public void core0029E()
        {
            string computedValue = "";
            System.Xml.XmlElement employeeIdElement = null;
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute newAttribute = null; 
            string expectedValue = "InvalidOperationException";

            testResults results = new testResults("Core0029E");
            try
            {
                results.description = "The \"setAttributeNode(newAttr)\" method raises an "+
                    "InvalidOperationException if \"newAttr\" attribute "+
                    "is already being used by another element.";
                //
                // Retrieve an already existing attribute from the "address" element.
                // 
                addressElement =  (System.Xml.XmlElement)util.nodeObject(util.FIFTH,util.SIXTH);
                newAttribute = addressElement.GetAttributeNode("street");//.node.
                //
                // Access the "employeeId" element of the last employee.
                //
                employeeIdElement = (System.Xml.XmlElement)util.nodeObject(util.FIFTH,util.FIRST);
                //
                // Attempt to set an attribute node with an already existing attribute node  
                // in another element.
                //
                try 
                {
                    employeeIdElement.SetAttributeNode(newAttribute);//.node.
                }
                catch(System.InvalidOperationException ex) 
                { 
                    computedValue = "InvalidOperationException"; 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0029E -------------------------
        //
        //-------------------------- test case core-0030E ---------------------------
        //
        // Testing feature - The "removeAttributeNode(oldAttr)" method raises a 
        //                   NOT_FOUND_ERR Exception if the "oldAttr" attribute
        //                   is not an attribute of the element.
        //
        // Testing approach - Retrieve the last employee and attempt to remove
        //                    a non existing attribute node.   This should cause 
        //                    the intended exception be raised.  This test makes use
        //                    of the "createAttribute(name)" method from the
        //                    Document interface.
        //
        // Semantic Requirements: 28
        //
        //----------------------------------------------------------------------------

        [Test]
	[Ignore(".NET DOM implementation does not match W3C DOM specification.")] // MS DOM is buggy
	public void core0030E()
        {
            string computedValue = "";
            System.Xml.XmlElement addressElement = null;
            System.Xml.XmlAttribute oldAttribute = (System.Xml.XmlAttribute)util.createNode(util.ATTRIBUTE_NODE,"oldAttribute");
            string expectedValue = "System.ArgumentException";//util.NOT_FOUND1_ERR;

            testResults results = new testResults("Core0030E");
            try
            {
                results.description = "The \"removeAttributeNode(oldAttr)\" method raises a " +
                    "NOT_FOUND_ERR Exception if \"oldAttr\" attribute " +
                    "is not an attribute of the element.";
                //
                // Access the "address" element of the last employee.
                //
                addressElement = (System.Xml.XmlElement)util.nodeObject(util.FIFTH,util.SIXTH);
                //
                // Attempt to remove a non-existing attribute. Should raise exception.
                //
                try 
                {
                    addressElement.RemoveAttributeNode(oldAttribute);//.node.
                }
                catch(ArgumentException ex) 
                {
                    computedValue = ex.GetType ().FullName; 
                }
            }
            catch(System.Exception ex)
            {
                computedValue = "Exception " + ex.Message;
            }
            results.expected = expectedValue;
            results.actual = computedValue;

            util.resetData();

            Assert.AreEqual (results.expected, results.actual);
        }

        //------------------------ End test case core-0030E --------------------------
    }
}