最近有机会接触自动化,记录下。。。
Dim FileName
FileName="..\jsmccProject\test.xml"
Set xmlDoc = XMLUtil.CreateXMLFromFile (FileName)
Set xmlRoot = xmlDoc.GetRootElement()
Set xmlValues = xmlRoot.ChildElementsByPath("Variable")
For i= 1 to xmlValues.Count
Set xmlElement = xmlValues.Item(i)
sName = xmlElement.ChildElementsByPath("Name").item(1).value
msgbox sName
Call WriteText(sName)
sValue = xmlElement.ChildElementsByPath("Value").item(1).value
Call WriteText(sValue)
msgbox sValue
Next
Function WriteText(str)
Set fileSystemObj = CreateObject("Scripting.FileSystemObject")
fileSpec = "..\jsmccProject\xml_text.txt"
Set logFile = fileSystemObj.OpenTextFile(fileSpec, 8, true)
logFile.WriteLine (str)
logFile.Close
Set logFile = Nothing
End Function