Hi there,
The following script produces one long line of tags.
How do you format the output to look like this using the XLMDOM?
Thanks!
The following script produces one long line of tags.
Code:
<?xml version="1.0"?>
<rootElement><childElement1/><childElement2/></rootElement>
How do you format the output to look like this using the XLMDOM?
Code:
<?xml version="1.0"?>
<rootElement>
<childElement1/>
<childElement2/>
</rootElement>
Code:
Dim objDom
Dim objRoot
Dim objChild1
Dim objChild2
Dim objPI
Set objDom = CreateObject("Microsoft.XMLDOM")
Set objRoot = objDom.createElement("rootElement")
objDom.appendChild objRoot
Set objChild1 = objDom.createElement("childElement1")
objRoot.appendChild objChild1
Set objChild2 = objDom.createElement("childElement2")
objRoot.appendChild objChild2
Set objPI = objDom.createProcessingInstruction("xml","version='1.0'")
objDom.insertBefore objPI, objDom.childNodes(0)
objDom.Save "c:\MyXMLDoc.xml"
Thanks!