Hi All,
I am trying to convert the CSV file to Xml file using VBScript.
I tried the following -
The attempt is to create the N xml nodes if the CSV file contains N columns.
In the above code snap I just tried to create a single node IN XML FILE.When I tried running that script found that the xml file contains nothing.Moreove r the script is running successfully.
I am not able to troubleshoot the problem. Why created xml document is blank ..?
Thanks!
I am trying to convert the CSV file to Xml file using VBScript.
I tried the following -
Code:
dim fso, tso , xmlobj, tsoCopy,arrDestFileLines ,outputfile
dim i
dim RootElement,CUSTOMER,testnode
set fso = CreateObject("Scripting.FileSystemObject")
i = 0
set xmlobj = CreateObject("Microsoft.XMLDOM")
set tso = fso.OpenTextFile("D:\SomePath\Input_File.csv")
set RootElement = xmlobj.CreateElement("REBATE")
Do Until tso.AtEndOfStream
arrDestFileLines = split(tso.ReadLine,",")
REM Attempt to add only one node - just for testing
if i = 0 Then
set CUSTOMER = xmlobj.CreateElement("CUSTOMER")
set testnode = xmlobj.CreateTextNode ("John")
CUSTOMER.appendchild(testnode)
RootElement.appendChild(CUSTOMER)
i = i + 1
end if
Loop
xmlobj.Save "D:\SomePath\OutputFile.xml"
In the above code snap I just tried to create a single node IN XML FILE.When I tried running that script found that the xml file contains nothing.Moreove r the script is running successfully.
I am not able to troubleshoot the problem. Why created xml document is blank ..?
Thanks!
Comment