[jQuery] 'Type mismatch' trying to append to XML node

[jQuery] 'Type mismatch' trying to append to XML node


Hi... First post, so be gentle...
I am trying to append a new entry into an XML document. This works
fine in FF but fails with a 'Type mismatch' error (line 170) in IE.
By using the .toXML() plugin, the output is '<hi><DIV
class="group">xxx</DIV><BUDGET _moz-userdefined=""><CAT _moz-
userdefined="">xxx</CAT></BUDGET></hi>'
I have tried in 1.1.3 & 1.1.2, both give the same error in IE.
function loadXML(text) {
    var xmlDoc = "";
    // code for IE
    if (window.ActiveXObject) {
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async="false";
        xmlDoc.loadXML(text);
    }
    // code for Mozilla, Firefox, Opera, etc.
    else if (document.implementation &&
            document.implementation.createDocument) {
            var parser=new DOMParser();
        var xmlDoc=parser.parseFromString(text,"text/xml");
    }
    else {
     alert('Your browser cannot handle this script');
    }
    return xmlDoc;
}
$(document).ready(function(){
    var fred="<hi></hi>";
    console.log(fred);
    // Push through XML processor
    xml = loadXML(fred);
    var b = $("hi:first", xml);
    var node = $("<div class='group' >xxx</div>");
    node.appendTo(b);
});