-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXMLConstructionExample03.htm
executable file
·44 lines (36 loc) · 1.54 KB
/
XMLConstructionExample03.htm
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
<!DOCTYPE html>
<html>
<head>
<title>XML Construction Example</title>
</head>
<body>
<p>This example only works in Firefox 1.5+.</p>
<script type="text/javascript;e4x=1">
var employees = <employees>
<employee position="Software Engineer">
<name>Nicholas C. Zakas</name>
</employee>
<employee position="Salesperson">
<name>Jim Smith</name>
</employee>
</employees>;
employees.appendChild(<employee position="Vice President">
<name>Benjamin Anderson</name>
</employee>);
employees.prependChild(<employee position="User Interface Designer">
<name>Michael Johnson</name>
</employee>);
employees.insertChildBefore(employees.child(2),
<employee position="Human Resources Manager">
<name>Margaret Jones</name>
</employee>);
employees.setChildren(<employee position="President">
<name>Richard McMichael</name>
</employee> +
<employee position="Vice President">
<name>Rebecca Smith</name>
</employee>);
alert(employees.toXMLString());
</script>
</body>
</html>