DOM way to convert an HTMLDocument object to XML:
new XMLSerializer().serializeToString(oDocument);
There is no way in Internet Explorer to get the proper XML representation of an HTML document object by any built-in means. There you will need to implement the serialization mechanism yourself - traversing the DOM tree and creating an XML string.
source
share