A
Argus Rogue
Hello All,
this is another post (also posted in alt.comp.lang.vbscript) and I was
wondering if it was possible to write a vbscript to that will do the
following:
1. read each xml file from a directory
2. search each xml file (status) for the text fail
3. write to output file in HTML format the status and the file name to
where you have the following:
Status Name
-------------------
Fail name of the file
Set ObjFSO = CreateObject("Scripting.FileSystemObject")
ObjStartFolder = "D:\Result_files\XML"
Set Objfolder = ObjFSo.GetFolder(objstartfolder)
Set ColFiles = Objfolder.files
For Each Objfile in ColFiles
strFileName = objfile.name
wscript.echo strFileName & VBCRLF
Dim objXML, Root, x
set objXML = CreateObject("Microsoft.XMLDOM")
objXML.async = "false"
objXML.load(strFileName)
Set Root = objXML.documentElement
For Each x In Root.childNodes
WScript.Echo x.text & VBCRLF <--would like to write to a file instead
Next
Next
I found some code to read each file in the directory (part 1) but how do i
do 2 and 3.
Any and all help in this matter is greatly appreciated.
Also Listed below is a sample of my result file.xml
<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl"
href="http://myweb.test.org/enterprisetesting/testharness/formatting/xslformat_verbose.xsl"
?><testresult><entry>
<level>0</level>
<status>info</status><name>Configuration File
Path</name><version>3.9</version>
<stepCounter>844</stepCounter>
<Description>C:\AutomationConfiguration\configuration.ini</Description>
<timestamp>12:40:09 PM</timestamp>
<duration>0</duration>
<link></link>
</entry>
<entry>
<level>4</level>
<status>DataTable
Path</status><name>C:\Automation\Automation_Test_1.xls</name><stepCounter>844</stepCounter>
<Description></Description>
<timestamp>12:40:09 PM</timestamp>
<duration>0</duration>
<link></link>
</entry>
<entry>
<level>0</level>
<status>enter-scenario</status><name>C:\Automation\Automation_Test_2.xml</name><stepCounter>844</stepCounter>
<Description></Description>
<timestamp>12:40:10 PM</timestamp>
<duration>0</duration>
<link></link>
</entry>
<entry>
<level>0</level>
<status>fail</status><name>Automation_Test_2</name><stepCounter>846</stepCounter>
<Description>C:\Automation\Automation_Test_2.xml</Description>
<timestamp>12:40:10 PM</timestamp>
<duration></duration>
<link></link>
</entry>
this is another post (also posted in alt.comp.lang.vbscript) and I was
wondering if it was possible to write a vbscript to that will do the
following:
1. read each xml file from a directory
2. search each xml file (status) for the text fail
3. write to output file in HTML format the status and the file name to
where you have the following:
Status Name
-------------------
Fail name of the file
Set ObjFSO = CreateObject("Scripting.FileSystemObject")
ObjStartFolder = "D:\Result_files\XML"
Set Objfolder = ObjFSo.GetFolder(objstartfolder)
Set ColFiles = Objfolder.files
For Each Objfile in ColFiles
strFileName = objfile.name
wscript.echo strFileName & VBCRLF
Dim objXML, Root, x
set objXML = CreateObject("Microsoft.XMLDOM")
objXML.async = "false"
objXML.load(strFileName)
Set Root = objXML.documentElement
For Each x In Root.childNodes
WScript.Echo x.text & VBCRLF <--would like to write to a file instead
Next
Next
I found some code to read each file in the directory (part 1) but how do i
do 2 and 3.
Any and all help in this matter is greatly appreciated.
Also Listed below is a sample of my result file.xml
<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl"
href="http://myweb.test.org/enterprisetesting/testharness/formatting/xslformat_verbose.xsl"
?><testresult><entry>
<level>0</level>
<status>info</status><name>Configuration File
Path</name><version>3.9</version>
<stepCounter>844</stepCounter>
<Description>C:\AutomationConfiguration\configuration.ini</Description>
<timestamp>12:40:09 PM</timestamp>
<duration>0</duration>
<link></link>
</entry>
<entry>
<level>4</level>
<status>DataTable
Path</status><name>C:\Automation\Automation_Test_1.xls</name><stepCounter>844</stepCounter>
<Description></Description>
<timestamp>12:40:09 PM</timestamp>
<duration>0</duration>
<link></link>
</entry>
<entry>
<level>0</level>
<status>enter-scenario</status><name>C:\Automation\Automation_Test_2.xml</name><stepCounter>844</stepCounter>
<Description></Description>
<timestamp>12:40:10 PM</timestamp>
<duration>0</duration>
<link></link>
</entry>
<entry>
<level>0</level>
<status>fail</status><name>Automation_Test_2</name><stepCounter>846</stepCounter>
<Description>C:\Automation\Automation_Test_2.xml</Description>
<timestamp>12:40:10 PM</timestamp>
<duration></duration>
<link></link>
</entry>