using variable as attribute in xpath expression - wrong group?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KathyB

    using variable as attribute in xpath expression - wrong group?

    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(Serve r.MapPath("test .xml"))
    Dim xNode = xNode.SelectSin gleNode("/WorkFlow/Assembly/Station[@name='"
    & strStation & "']/WI[1]/@doc")
    Dim strWI As String = xDoc.InnerText. ToString()
Working...