Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old October 14th, 2008, 07:15 AM
Steve
Guest
 
Posts: n/a
Default loading xml in IE6

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.
  #2  
Old October 14th, 2008, 11:15 AM
Martin Honnen
Guest
 
Posts: n/a
Default Re: loading xml in IE6

Steve wrote:
Quote:
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/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles