I want to create a XML-file with some data, but IE8 throwsout an error. With FF and Chrome my script works. Any idea why col.appendChild(document.createTextNode(this))
doesn't work with IE8?
var xmlDoc = $.parseXML("<?xml version=\"1.0\" encoding=\"UTF-8\"?><mapping-table/>");
//Append rows with col to XML-document
$.each(trData, function(){
var row = xmlDoc.createElement('row');
$.each(this, function(){
var col = xmlDoc.createElement('col');
col.appendChild(document.createTextNode(this));
row.appendChild(col);
});
xmlDoc.documentElement.appendChild(row);
});
You are calling the method createElement
on your XML document, which is fine.
But you are creating your text node in the scope of your (html) document
object – instead of creating it in the scope of your XML document as well.
Use xmlDoc.createTextNode
instead.