XMLSerializer() object is apparently supported in IE9+ however if you are trying to write anything for compatibility with IE7/8 and you want to serialize your DOM object (instantiated as ActiveXObject("Microsoft.XMLDOM")) you have to work around
var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
xmlDom.setAttribute("name","value");
serializedText = xmlDom.transformNode(xmlDom);
serializedText will contain a serialized version of the dom objects contents, this achieves the same as:
dom = document.implementation.createDocument('','',null);
serializer = new XMLSerializer();
serializedText = serializer.serializeToString(dom);
- would achieve in a proper browser that is standards compliant.
note, if you are getting lots of "Message: Type mismatch" errors in internet explorer on dom.setAttribute(), it will not accept null as a parameter.