Different browsers parse XML differently
firefox
webkit
The following code can be parsed in Firefox, but not in Google and IE. How should I modify the code? How to parse XML
The following code can be parsed in Firefox, but not in Google and IE. How should I modify the code? How to parse XML?
JScript code:
The code is as follows:
$("#result").append(xmlDoc.firstChild.localName + "
");
for ( var i = 0; i < xmlDoc.documentElement.childElementCount; i++) {
$("#result").append(
xmlDoc.documentElement.children[i].localName + "
");
}
Compatible with IE, Firefox, Chrome, Safari, Opera, etc. The code for the browser's XML file loading method is as follows. The xml file name is 1.xml.
XML code
XML code:
The code is as follows:
HTML code
HTML code:
The code is as follows:
Name | Website |