Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


vbscript and xml

From: "Argus Rogue" <argusrogue@----.--.--->
To: NULL
Date: 2/1/2008 5:04:00 AM

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>




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent