LoadXml method not supported in IE 9.
-
Monday, August 20, 2012 7:30 AM
Hi all ,
In my case we get the data from aspx page in XML form . We are using XMLHttprequest to get the data . When response is ready , we create XML document like
function CreateXMLDocument(rootTagName, namespaceURL)
{
alert(rootTagName);
alert(namespaceURL);
if (!rootTagName) rootTagName = "";
if (!namespaceURL) namespaceURL = "";
if (document.implementation && document.implementation.createDocument) {
// This is the W3C standard way to do it
return document.implementation.createDocument(namespaceURL, rootTagName, null);
}
else { // This is the IE way to do it
// Create an empty document as an ActiveX object
// If there is no root element, this is all we have to do
var doc = new ActiveXObject("MSXML2.DOMDocument");
// If there is a root tag, initialize the document
if (rootTagName) {
// Look for a namespace prefix
var prefix = "";
var tagname = rootTagName;
var p = rootTagName.indexOf(':');
if (p != -1) {
prefix = rootTagName.substring(0, p);
tagname = rootTagName.substring(p+1);
}
// If we have a namespace, we must have a namespace prefix
// If we don't have a namespace, we discard any prefix
if (namespaceURL) {
if (!prefix) prefix = "a0"; // What Firefox uses
}
else prefix = "";
// Create the root element (with optional namespace) as a
// string of text
var text = "<" + (prefix?(prefix+":"):"") + tagname +
(namespaceURL
?(
" xmlns:" + prefix + '="' + namespaceURL +'"')
:
"") +
"/>";
// And parse that text into the empty document
doc.loadXML(text);
}
alert(text);
return doc;
}
} and then we use objxmlDoc.LoadXML() . But it gives an error in IE 9 saying method not supported. Can someone please help with this?
Siddhesh Sawant
All Replies
-
Tuesday, August 28, 2012 1:05 AMModerator
Hi, you can use C# to create XML file, please refer to the following example:
http://stackoverflow.com/questions/543319/how-to-return-xml-in-asp-net


