K
KathyB
Hi, I'm using the following xmlDocument and xpath to load a file using
a variable.
I've tried several renditions of the xpath using the variable but
without success (error: object variable not set). If I hardcode it as
[@name="Label"] it works so I know the xpath is ok, except for the
variable syntax?
Any hints appreciated. Thanks, kathy
Code:
Dim strStation As String = "Label" 'ultimately need var set from
control
Dim xDoc As New XmlDocument()
xDoc.Load(Server.MapPath("test.xml"))
Dim xNode = xNode.SelectSingleNode("/WorkFlow/Assembly/Station[@name='"
& strStation & "']/WI[1]/@doc")
Dim strWI As String = xDoc.InnerText.ToString()
a variable.
I've tried several renditions of the xpath using the variable but
without success (error: object variable not set). If I hardcode it as
[@name="Label"] it works so I know the xpath is ok, except for the
variable syntax?
Any hints appreciated. Thanks, kathy
Code:
Dim strStation As String = "Label" 'ultimately need var set from
control
Dim xDoc As New XmlDocument()
xDoc.Load(Server.MapPath("test.xml"))
Dim xNode = xNode.SelectSingleNode("/WorkFlow/Assembly/Station[@name='"
& strStation & "']/WI[1]/@doc")
Dim strWI As String = xDoc.InnerText.ToString()