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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:55:48+00:00 2026-05-27T11:55:48+00:00

Here is the XML I have in a file: SPECIAL NOTE: This is a

  • 0

Here is the XML I have in a file:

SPECIAL NOTE:
This is a question for Windows Phone 7, not general C#

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <item>
        <date>01/01</date>
        <word>aberrant</word>
        <def>straying from the right or normal way</def>
    </item>

    <item>
        <date>01/02</date>
        <word>Zeitgeist</word>
        <def>the spirit of the time.</def>
    </item>
</rss>

I need it in a List (aka array) of Dictionary objects. Each Dictionary represents an <item>. Each element like <word> is the key with type string and each value like “Zeitgeist” is the value with type string.

Is there any easy way to do this? I’m coming from Objective-C and iOS so this is completely new to me with .NET and C#.

  • 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-27T11:55:49+00:00Added an answer on May 27, 2026 at 11:55 am

    LINQ-to-XML makes it pretty easy. Here’s a complete example:

            public static void Main(string[] args)
            {
                string xml = @"
    <rss version='2.0'>
        <item>
            <date>01/01</date>
            <word>aberrant</word>
            <def>straying from the right or normal way</def>
        </item>
    
        <item>
            <date>01/02</date>
            <word>Zeitgeist</word>
            <def>the spirit of the time.</def>
        </item>
    </rss>";
                var xdoc = XDocument.Parse(xml);
                var result = xdoc.Root.Elements("item")
                    .Select(itemElem => itemElem.Elements().ToDictionary(e => e.Name.LocalName, e => e.Value))
                    .ToList();
    
            }
    

    Instead of loading from a string with XDocument.Parse(), you would probably do XDocument.Load(filename) but either way you get an XDocument object to work with (I did a string just for example).

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

Sidebar

Related Questions

Here is what I have: <?xml version=1.0 encoding=utf-8?> <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml backgroundColor=#ffffff> <mx:VBox percentHeight=100 percentWidth=100
I have xml file with list of hobby as : <?xml version=1.0 encoding=utf-8?> <users>
I have a XML file. Here is a small version of that. <?xml version=1.0
I have an xml file called index.xml this is in my website here: www.mywebsite.com/siteregistry/index.xml
I have an XML file that is very long, but here is a shot
Bit of a beginner question here: Say I have a block of xml: <root>
I have two XML file sitemap.xml and mouse.xml which look like below.Here the thing
The setup: I have an external XML file I have no control over, here
I have this XML file that I parse into its elements and create a
I have to create an XML file dynamically based on the user input. Here

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.