DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Create A Cross Browser Compatible Dom Document In Javascript

02.09.2006
| 471 views |
  • submit to reddit
        // create a cross browser compatible dom document in javascript

var xmlDoc = null;

if (window.ActiveXObject){
	xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.async = "false";
	xmlDoc.loadXML(xmlresults);
}
else if (document.implementation && document.implementation.createDocument){
	xmlDoc= document.implementation.createDocument("","",null);
	xmlDoc.loadXML(xmlresults);
}