代码编辑器:
x
1
<h3>This demonstrates a parser error:</h3>
2
<script>
3
var xmldoc = null;
4
function loadxml(filename)
5
{
6
if (window.ActiveXObject) {
7
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
8
xmldoc.async = false;
9
xmlDoc.validateOnParse="true"
10
xmldoc.load(filename);
11
}
12
else if (document.implementation && document.implementation.createDocument)
13
{
14
var xmlhttp = new window.XMLHttpRequest();
15
xmlhttp.open("get", filename, false);
16
xmlhttp.send(null);
17
var parser = new DOMParser();
18
var xmldoc = parser.parseFromString(xmlhttp.responseText, "application/xml");