Discussion:
If xmldoc Node Exists then??
(too old to reply)
firebladeboy
2006-05-16 03:48:01 UTC
Permalink
Hi, I'm having trouble finding how to check if a xml node exists in an (MBSA)
xml document then to perform the next command.

I have the code to return the node itself as strTest, how do I check of the
node exists first as this script will fail if Check[@ID='174'] is not present
in the XML doc?

' Retrieve Office Patch Advice Summary Node
Set xmlRoot = xmlDoc.documentElement
Set nodeID = xmlDoc.SelectSingleNode("SecScan/Check[@ID='174']/Advice")
strTest = trim(nodeID.text)

Thanks

Dion
ekkehard.horner
2006-05-16 07:00:28 UTC
Permalink
Post by firebladeboy
Hi, I'm having trouble finding how to check if a xml node exists in an (MBSA)
xml document then to perform the next command.
I have the code to return the node itself as strTest, how do I check of the
in the XML doc?
' Retrieve Office Patch Advice Summary Node
Set xmlRoot = xmlDoc.documentElement
If nodeID Is Nothing Then
MsgBox "not found"
Else
Post by firebladeboy
strTest = trim(nodeID.text)
End If
Post by firebladeboy
Thanks
Dion
Joe Fawcett
2006-05-16 08:10:26 UTC
Permalink
Post by firebladeboy
Hi, I'm having trouble finding how to check if a xml node exists in an (MBSA)
xml document then to perform the next command.
I have the code to return the node itself as strTest, how do I check of the
in the XML doc?
' Retrieve Office Patch Advice Summary Node
Set xmlRoot = xmlDoc.documentElement
strTest = trim(nodeID.text)
Thanks
Dion
If nodeID Is Nothing Then
'No node found
Else
strTest = trim(nodeID.text)
End If
--
Joe Fawcett (MVP - XML)

https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5
Loading...