K
Kathy Burke
Hi, I continue to have trouble with this. Using the following xml
sample:
<Station name="Station1" line_stop="yes"/>
OR when NO line_stop attribute exists.
In asp.net page, I use xpath to determine IF the line_stop attribute
exists (or am TRYING to!)
Dim xDoc as XmlDocument
Dim xNode As XmlElement =
xDoc.SelectSingleNode("//Station[@name='Station1'][@line_stop='yes']")
If Not xNode.Value Is Nothing Then
If xNode.Value = "yes" Then
do this...
End If
End If
If there is no line_stop attribute, I get an error for "Object reference
not set to an instance of an object" at the If Not xNode.Value
line...obviously returning no node.
Please tell me where I'm going wrong.
Thanks,
Kathy
sample:
<Station name="Station1" line_stop="yes"/>
OR when NO line_stop attribute exists.
In asp.net page, I use xpath to determine IF the line_stop attribute
exists (or am TRYING to!)
Dim xDoc as XmlDocument
Dim xNode As XmlElement =
xDoc.SelectSingleNode("//Station[@name='Station1'][@line_stop='yes']")
If Not xNode.Value Is Nothing Then
If xNode.Value = "yes" Then
do this...
End If
End If
If there is no line_stop attribute, I get an error for "Object reference
not set to an instance of an object" at the If Not xNode.Value
line...obviously returning no node.
Please tell me where I'm going wrong.
Thanks,
Kathy