Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-10-20
3
Medium Priority
?
204 Views
Last Modified: 2010-04-23
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
Comment
Question by:brokeMyLegBiking
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Mohamed Zedan earned 2000 total points
ID: 17780450
this xpath should work for you :
"/SecurityDataset/loginAction[username='mylogin' and action_name='not-run_funding_reports']"
0
 
LVL 7

Expert Comment

by:Mohamed Zedan
ID: 17780453
any qustions just ask :)
0
 
LVL 4

Author Comment

by:brokeMyLegBiking
ID: 17780657
ok, interesting, didn't know you could use an and statement in xpath, cool.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question