I am looking for a way to prettyprint a DOM but to another DOM!
Apply indent formatting, but inside the DOM!

I got as far as the code below, but this did not work!

Code:
Dim xmlDoc As New MSXML2.DOMDocument40
Call xmlDoc.Load("C:\input.xml")

Dim xmlWriter As New MSXML2.MXXMLWriter40
xmlWriter.byteOrderMark = True
xmlWriter.indent = True
xmlWriter.omitXMLDeclaration = False

Dim xmlNewDoc As New MSXML2.DOMDocument40
xmlNewDoc.preserveWhiteSpace = True

xmlWriter.output = xmlNewDoc

Dim saxReader As New MSXML2.SAXXMLReader40
Set saxReader.contentHandler = xmlWriter
Call saxReader.parse(xmlDoc)

Call xmlNewDoc.Save("C:\output.xml")
Although in the above code I Load the DOM from a text file and Save the DOM to a text file, I am in practice constructing the DOM and sending the DOM to third party code, which requires the whitespace of the PrettyPrint

Any Ideas