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 8238081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:41:27+00:00 2026-06-07T19:41:27+00:00

I have the following XML file: <Categories> <Category name=TopDown> <Path>http://localhost:8080/images/TopDown/Divx.png</Path> <Path>http://localhost:8080/images/TopDown/Blu-Ray.png</Path> <Path>http://localhost:8080/images/TopDown/Divx.png</Path> <Path>http://localhost:8080/images/TopDown/Divx.png</Path> <Path>http://localhost:8080/images/TopDown/Divx.png</Path>

  • 0

I have the following XML file:

<Categories>
<Category name="TopDown">
    <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
    <Path>http://localhost:8080/images/TopDown/Blu-Ray.png</Path>
    <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
    <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
    <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
    <Path>http://localhost:8080/images/TopDown/Divx.png</Path>  
</Category>
<Category name="SideScroll">
    <Path>http://localhost:8080/images/SideScroll/MediaMonkey.png</Path>
    <Path>http://localhost:8080/images/SideScroll/Miro.png</Path>
    <Path>http://localhost:8080/images/SideScroll/QuickTime.png</Path>
    <Path>http://localhost:8080/images/SideScroll/VLC.png</Path>
    <Path>http://localhost:8080/images/SideScroll/WinAmp.png</Path>
</Category>

In my c# code, I have a function that gets a string that represents the Category “name” attribute, and if that string equals to that attribute I’d like to get all the text between the “Path” tags.
For Instance, if the function gets a string parameter that equals “TopDown” the output would be :

http://localhost:8080/images/TopDown/Divx.png
    http://localhost:8080/images/TopDown/Blu-Ray.png
    http://localhost:8080/images/TopDown/Divx.png
    http://localhost:8080/images/TopDown/Divx.png
    http://localhost:8080/images/TopDown/Divx.png
    http://localhost:8080/images/TopDown/Divx.png

Thank you.

  • 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-06-07T19:41:28+00:00Added an answer on June 7, 2026 at 7:41 pm

    You can do this with LINQ To XML:

    var xdoc = @"<Categories>
        <Category name='TopDown'>
            <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
            <Path>http://localhost:8080/images/TopDown/Blu-Ray.png</Path>
            <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
            <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
            <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
            <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
        </Category>
        <Category name='SideScroll'>
            <Path>http://localhost:8080/images/SideScroll/MediaMonkey.png</Path>
            <Path>http://localhost:8080/images/SideScroll/Miro.png</Path>
            <Path>http://localhost:8080/images/SideScroll/QuickTime.png</Path>
            <Path>http://localhost:8080/images/SideScroll/VLC.png</Path>
            <Path>http://localhost:8080/images/SideScroll/WinAmp.png</Path>
        </Category>
    </Categories>";
    
    var paths = XDocument.Parse(xdoc).Descendants("Category")
            .Where(w => (string)w.Attribute("name") == "TopDown")
            .Select(s => s.Elements("Path").Select (x => (string)x)).ToList();
    
    
    foreach (var x in paths)
        Console.WriteLine(x);
    

    You can copy paste that into linqpad or visual studio and it’ll run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML File: <persons> <person name=shawn> <age>34</age> <hair style=spikes>red</hair> </person> <person
I have the following XML layout file, HELPME.XML <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent
I have the following in an XML file: <entry> ... <link href=http://www.example.com/somelink /> ...
I have the following text in xml file: <Config Builder=LP Wizard> <Libraries> <Library Name=XCAMSource/>
I have the following xml file <Layout xmlns=http://tempuri.org/Layout/> <Numeric Id=temperature Caption=Temperature> <validation:IsValidWhen xmlns:validation=http://tempuri.org/Validation/> </validation:IsValidWhen>
I have the following xml file <gallery> <album title=test description=test lgPath=/images/commphotos/> <img src=1130975173.jpg />
I have the following XML file: <?xml version=1.0 encoding=utf-8 ?> <scripts> <ScriptName> <name> My
Lets say I have the following XML file: <?xml version=1.0 encoding=utf-8?> <Customers xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=Customer.xsd>
I have the following XML file: <?xml version=1.0 encoding=utf-8 ?> <strategies> <strategy name=God Class>
I have the following XML file <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:tools=http://schemas.android.com/tools android:layout_width=match_parent android:layout_height=match_parent android:background=@drawable/welcome_bg > <FrameLayout

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.