ik heb hier code om te schrijven in een xml, maar dit doet hij niet, ik krijg de error "automation server can't create object" wat is hier fout aan?
code:
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
| <html>
<head>
<title>Test</title>
<script language="JavaScript">
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmlDoc.async = false;
xmlDoc.load("test.xml");
//create new element
var newElem = xmlDoc.createElement("pages");
//start from the root element
var root = xmlDoc.documentElement;
//find the first child of the root element (using collection syntax)
var firstElem=root.childNodes.item(1);
//find the first child of the first child (using property syntax)
var refElem = firstElem.firstChild;
//insert our new pages element
root.childNodes.item(1).insertBefore(newElem, refElem);
//report the content of the first child of the root element
alert(firstElem.xml);
</script>
</head>
<body>
</body>
</html> |