• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

xpath query that will search for a node with a certain value.

I need to search my xmlDocument for a <loginAction> node such that the value of <username> is equal to a certain value, and <action_name> is equal to a certain value. Here is the routine I need to complete:

    Public Shared Function can_do(ByVal action_name As String) As Boolean
        If xSecurity.DocumentElement.SelectSingleNode("need an xpath statement here") IsNot Nothing Then
            Return True
        Else
            Return False
        End If
    End Function


Here is the xmlDocument:

<SecurityDataset>
  <loginAction>
    <username>mylogin</username>
    <action_name>not-run_funding_reports</action_name>
  </loginAction>
</SecurityDataset>

0
brokeMyLegBiking
Asked:
brokeMyLegBiking
  • 2
1 Solution
 
Mohamed ZedanCommented:
this xpath should work for you :
"/SecurityDataset/loginAction[username='mylogin' and action_name='not-run_funding_reports']"
0
 
Mohamed ZedanCommented:
any qustions just ask :)
0
 
brokeMyLegBikingAuthor Commented:
ok, interesting, didn't know you could use an and statement in xpath, cool.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now