Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7579327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:39:03+00:00 2026-05-30T17:39:03+00:00

Given the following XML file: <users> <user name=admin password=foobar roles=Admin,Guest /> <user name=guest password=foobar

  • 0

Given the following XML file:

<users>
  <user name="admin" password="foobar" roles="Admin,Guest" />
  <user name="guest" password="foobar" roles="Guest" />
</users>

How do I find a specific node? In this case I want to find the node that has its name attribute to be “admin”

    Dim authGroup As XElement = XElement.Parse(myXMLDoc.OuterXml)
    Dim foundUser As IEnumerable(Of XElement) = From i In authGroup.Elements Where i.Attributes("name") = "admin" Select i

    'How can I determine if the user was found?
    Dim p As String =  ...... (get the password from foundUser)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:39:04+00:00Added an answer on May 30, 2026 at 5:39 pm
    Dim doc As XElement =
        <users>
            <user name="admin" password="foobar" roles="Admin,Guest" />
            <user name="guest" password="foobar" roles="Guest" />
        </users>
    Dim userName = "admin"
    
    Dim result =
        doc.Descendants("user")                                                    _
           .Where(Function(user) CType(user.Attribute("name"), String) = userName) _
           .SingleOrDefault
    
    If result IsNot Nothing Then
        ' user found '
        Dim pw = CType(result.Attribute("password"), String)
        ' do something with pw '
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following xml file (users_doc.xml) <users> <user trusted=false> <userid>vsony7@vt.edu</userid> <password>sony</password> </user>
Given the following xml fragment: <Problems> <Problem> <File>file1</File> <Description>desc1</Description> </Problem> <Problem> <File>file1</File> <Description>desc2</Description> </Problem>
Given the following XML 'template': <Request module=CRM call=list_service_features id={ID}> <block name=auth> <a name=username format=text>{USERNAME}</a>
I am trying to create hash from xml file Hash.from_xml <<-EOX <user> <id>1</id> <user-name>ryan</user-name>
Given the following XML file: <?xml version=1.0 encoding=utf-8?> <Wix xmlns=http://schemas.microsoft.com/wix/2006/wi> <Fragment> <DirectoryRef Id=INSTALLLOCATIONAGENT> <Component
I would like your help in the following : given the .xml file :
Given some sample data.xml file: <?xml version=1.0 encoding=utf-8?> <data> <categories> <category id=google> <name>Google</name> </category>
Given the following XML: <current> <login_name>jd</login_name> </current> <people> <person> <first>John</first> <last>Doe</last> <login_name>jd</login_name> </preson> <person>
Given the following XML structure <html> <body> <div> <span>Test: Text2</span> </div> <div> <span>Test: Text3</span>
Given the following XML: <databases> <database> <title_display>Aardvark</title_display> </database> <database> <title_display>Apple</title_display> </database> <database> <title_display>Blue</title_display> </database>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.