--- <snipper---
' retrieve the (untidy) xml from the dom...
Dim sXML ' as string
sXML = xmlDoc.xml
' MsgBox(sXML)
' ----------------------------------------------
' tidy up the result...
' ----------------------------------------------
Dim sTidyXML ' as string
' (first step) tidy the result...
sTidyXML = Replace(sXML, ">", ">" & vbCrLf)
' (second step)
sTidyXML = Replace(sTidyXML, "<", " <")
' MsgBox(sTidyXML)
' (third step) remove indent from rootnode tags...
sTidyXML = Replace(sTidyXML, " <?", "<?")
sTidyXML = Replace(sTidyXML, vbCrLf & vbCrLf, vbCrLf)
sTidyXML = Replace(sTidyXML, " <" & sRootNodeName, "<" &
sRootNodeName)
sTidyXML = Replace(sTidyXML, " </" & sRootNodeName, "</" &
sRootNodeName)
MsgBox(sTidyXML)
' sXMLTidySpec = GetLocalDirectory() & sXMLTidyFile ' for debugging
sXMLTidySpec = fso.GetSpecialFolder(tempFolder) & "\" & sXMLTidyFile
' construct the output file...
dbPrint sMe & "save xml tidy file: " & sXMLTidySpec
' write out the tidy file...
Dim oFile, oTextStream ' as object(s)
fso.CreateTextFile sXMLTidySpec, allowOverwrite ' creates the file
(no return)...
Set oXMLOutFile = fso.GetFile(sXMLTidySpec) ' "objectify" the file...
Set oTextStream = oXMLOutFile.OpenAsTextStream(ForWriting) ' ,
TristateUseDefault)
oTextStream.Write sTidyXML
oTextStream.Close
--- <end snippet---
Crude but effective, jw
Highlander wrote:
Quote:
jw - Can you post the code for the "tidy-up-xml" mini-app that you
wrote? Or point me in the direction of where I can find the other
mini-apps that are out there? Thanks!
>
- Dave
>
|