-
February 1st, 2007, 02:47 AM
#1
PrettyPrint DOM
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
All code on this page is protected by an SEP field!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|