Writing text stream in VB6

less than 1 minute read

I had rather unusual experience of writing VB6 code in 2007. I had to support one of old applications, written probably around 2001. It is to write XML file into text stream. The codes are like the followings.

[sourcecode language='vb']

Dim objXMLResult As MSXML2.FreeThreadedDOMDocument30
Set objXMLResult = New MSXML2.FreeThreadedDOMDocument30

Dim objProcessor As MSXML2.IXSLProcessor
Set objProcessor = objXSLTemplate.createProcessor
objProcessor.input = objXMLDoc
objProcessor.addParameter "SiteID", 4
'objProcessor.output = objResultStream

Dim translateXml As String
Dim objFileSystem As New FileSystemObject
Dim objStream As TextStream
objFileSystem.CreateTextFile "c:\temp\XslResult.txt", True, True
Set objStream = objFileSystem.OpenTextFile("c:\temp\XslResult.txt", ForWriting)

translateXml = objProcessor.output
objStream.Write translateXml