By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

loading xml in IE6

P: n/a
The following lines of script work fine in Firefox but give an "object
doesn't support this property or method" error in IE6. Could someone
recommend a way of loading a local xml file that also works for IE.

var doc = document.implementation.createDocument('', 'dummy', null);
doc.load('test.xml');

Thanks in advance, Steve.
Oct 14 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Steve wrote:
The following lines of script work fine in Firefox but give an "object
doesn't support this property or method" error in IE6. Could someone
recommend a way of loading a local xml file that also works for IE.

var doc = document.implementation.createDocument('', 'dummy', null);
doc.load('test.xml');
You can use XMLHttpRequest (with IE 7 and 8) respectively new
ActiveXObject('Msxml2.XMLHTTP') in IE 6 (or older) to load the XML
document, then access the responseXML property to have an XML DOM document.
Or use
var doc = new ActiveXObject('Msxml2.DOMDocument');
doc.onreadystatechange = function ()
{
if (doc.readyState === 4)
{
// now use doc here
}
};
doc.load('test.xml');
that should work as long as scripting of ActiveX objects is enabled.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 14 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.