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

brokeMyLegBiking
brokeMyLegBiking used Ask the Experts™
on
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>

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior IT Analyst
Commented:
this xpath should work for you :
"/SecurityDataset/loginAction[username='mylogin' and action_name='not-run_funding_reports']"
Mohamed ZedanSenior IT Analyst

Commented:
any qustions just ask :)

Author

Commented:
ok, interesting, didn't know you could use an and statement in xpath, cool.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial