TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rashmi kaneri
NA
6
5.7k
how to write C# code from vbScript
Aug 16 2016 12:30 AM
I am new to C# and i am given vbscript to convert to "create xml file" in C#.
i don't understand Dim and how to interpret in C#. Can someone please provide Sample code for this.
Please help
Function FWC_UTL_XML_CreateXML(strPath)
'On Error Resume Next
Dim objDOM, objNode, objManager, objTester, objDeveloper, ObjHighLevel, objGrandChildNode
Dim strHighLevelInfoPath, strText, strNodes, strNodesScplit, strSplit, IntCount
' Create the main xml node
Set objDOM = CreateObject("Microsoft.XMLDOM")
' Set objNode = objDOM.createNode(7, "xml", "")
' objDOM.appendChild objNode
Set objNode = objDOM.CreateProcessingInstruction("xml-stylesheet", "type='text/xsl' href='XmlReference/LogReport.xsl'")
objDOM.InsertBefore objNode, objDOM.childNodes(0)
objDOM.AppendChild(objNode)
Set objNode = objDOM.createNode(1, "Root", "")
' Read the XML nodes from the Notepad
strHighLevelInfoPath = projectSuite.path & "Inputs\HighLevelInfo.txt"
strText = aqFile.ReadWholeTextFile(strHighLevelInfoPath, 20)
strNodes = "MachineName$%UserName$%Application$%TestingType$%OperatingSystem$%BuildVersion"
strNodesScplit = Split(strNodes, "$%")
' Split the string and add nodes
strSplit = Split(strText, "$%")
Set ObjHighLevel = objDOM.createNode(1, "HighLevelInfo", "")
Set objGrandChildNode = objDOM.createNode(1, strNodesScplit(0), "")
objGrandChildNode.Text = Sys.HostName
ObjHighLevel.appendChild (objGrandChildNode)
For IntCount = 1 to UBound(strSplit)
Set objGrandChildNode = objDOM.createNode(1, strNodesScplit(IntCount), "")
objGrandChildNode.Text = strSplit(IntCount)
ObjHighLevel.appendChild (objGrandChildNode)
Next
Set objGrandChildNode = objDOM.createNode(1, "ExecuteDateTime", "")
objGrandChildNode.Text = Now
ObjHighLevel.appendChild (objGrandChildNode)
objNode.appendChild ObjHighLevel
objDOM.appendChild objNode
Set objNode = Nothing
Call objDOM.save(strPath)
Set objDOM = Nothing
End Function
Reply
Answers (
3
)
how to save database record in to excel using C#
Logic Program. programming Interconnection between user cont