Hi y’all
Writing a vbscript for monitoring purposes I try to get some information out of an XML file.
I thought that should be REASONABLY straight forward but I’m now reconsidering that.
Started up in good spirit but having been given NULL results back so fare I’m now down to a simple script to give me back what is in the file. But still no results back!!!
I just wonder if some of you can lead me in the right direction??? Any suggestions where I tokk the wrong turn??
The script I use looks like this:
Dim xmlDoc, colNodes
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "False"
xmlDoc.load("c:\Scripts\NorgesBank\swpreadlog.xml")
Set colNodes = xmlDoc.selectNodes _
("/Swp:LogEvents/Swp:LogEvent/*")
For Each objNode in colNodes
Wscript.Echo objNode.Text
Next
I have a file like this:
<?xml version="1.0" ?>
-<Swp:LogEvents xmlns:Swp="urn:swift:swp:ns_Swp">
-<Swp:LogEvent sequence="14851" dateTime="03/12/2013 23:00:00.1440">
<Swp:LogLevel>Warning</Swp:LogLevel>
<Swp:ApplicationPackage>Alliance Web Platform 7.0.20</Swp:ApplicationPackage>
<Swp:BrowserIP>a.b.c.d</Swp:BrowserIP>
<Swp:ServerIP>a.b.c.d</Swp:ServerIP>
<Swp:Class>Configuration</Swp:Class>
<Swp:Key>certificate.expires30</Swp:Key>
<Swp:EventNumber>10022</Swp:EventNumber>
<Swp:User>null</Swp:User>
-<Swp:Message truncated="No">
- <![CDATA[
The Alliance Web Platform certificate will expire in [Ljava.lang.String;@34df01 days.
]]>
</Swp:Message>
<Swp:JClass>com.swift.sawa.platform.configuration.CertificateMDB</Swp:JClass>
<Swp:JMethod>timeout</Swp:JMethod>
</Swp:LogEvent>
-<Swp:LogEvent sequence="14852" dateTime="04/12/2013 01:35:47.4140">
<Swp:LogLevel>Severe</Swp:LogLevel>
<Swp:ApplicationPackage>Alliance Web Platform 7.0.20</Swp:ApplicationPackage>
<Swp:BrowserIP>a.b.c.d</Swp:BrowserIP>
<Swp:ServerIP>a.b.c.d</Swp:ServerIP>
<Swp:Class>Software</Swp:Class>
<Swp:Key>servers.AccessInstance.status.unreachable</Swp:Key>
<Swp:EventNumber>10018</Swp:EventNumber>
<Swp:User>null</Swp:User>
-<Swp:Message truncated="No">
- <![CDATA[
Alliance Access/Entry instance "SAAT" is unreachable:
Failed to connect to Alliance Access/Entry due to a network problem.
Make sure that the hostname and port number are correct.
Connection refused: connect
]]>
</Swp:Message>
<Swp:JClass>com.swift.sawa.platform.connectivity.ConnectivityTestBean</Swp:JClass>
<Swp:JMethod>onInstanceStatusChanged</Swp:JMethod>
</Swp:LogEvent>