I have an xml file which may or may not have information in a particular node.
I am trying to assign the value of this element (which will either be a 1 or nothing) to a variable called strTest.
This works fine if the element contains a "1" , however if the element is empty i get an automation error (clearly cause you cannot assign an empty node.typedValue to a string.
Can any1 suggest how i can ckeck to see if the node.typedValue is a "1" and if so to assign it to a string, but if its empty to assign a "0" to the string
or perhaps using a 1,0 boolean
For i = 0 To nodes.Length - 1
strTest (nodes.NextNode.selectSingleNode("REASON").nodeTypedValue)
Next
Dim xmlDocIssueNumber As DOMDocument
Set xmlDocIssueNumber = New DOMDocument
xmlDocIssueNumber.preserveWhiteSpace = True
xmlDocIssueNumber.loadXML (cIssueNoXML)
xmlDocIssueNumber.Save ("C:\Documents and Settings\Simon Pogrebinsky\Desktop\xmlSave\issueNo.xml")
Set nodes = xmlDocIssueNumber.selectNodes("//NewDataSet/AUTONUMBTABLE/AUTOFLAG")
For i = 0 To nodes.Length - 1
If Not (nodes.NextNode.selectSingleNode("AUTOFLAG") Is Nothing) Then strFaultFlag = ((nodes.NextNode.selectSingleNode("AUTOFLAG").nodeTypedValue))
The NodeList you are creating is already a list of AUTOFLAG nodes so you don't need to go any deeper. That simplifies it a bit. I also changed "nodes" since that's a reerved word.
You're welcome. Now that we've helped you, you can help us by pulling down the Thread Tools menu and clicking the Mark Thread Resolved button which will let everyone know that you have your answer.