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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:59:52+00:00 2026-06-12T04:59:52+00:00

I have by example following XML: string xml = @<plist version=’1.0′> <dict> <key>DataType</key> <string>Employee</string>

  • 0

I have by example following XML:

string xml =
@"<plist version='1.0'>
    <dict>
        <key>DataType</key>
        <string>Employee</string>
        <key>8000</key>
        <dict>
            <key>Id</key>
            <string>8000</string>
            <key>Prename</key>
            <string>Walter</string>
            <key>Name</key>
            <string>Walter Lohner Stans</string>
            <key>Initials</key>
            <string>MAL</string>
        </dict>
        <key>8001</key>
        <dict>
            <key>Id</key>
            <string>8001</string>
            <key>Prename</key>
            <string>Motorrad</string>
            <key>Name</key>
            <string> Meierskappel</string>
            <key>Initials</key>
            <string>MAM</string>
        </dict>
        <key>8004</key>
        <dict>
            <key>Id</key>
            <string>8004</string>
            <key>Prename</key>
            <string>Hanspeter</string>
            <key>Name</key>
            <string>Altenbürger AG  Horgen</string>
            <key>Initials</key>
            <string>FH</string>
        </dict>
    </dict>
</plist>";

I would like to get these 3 Employees as a List…

The Class Employee is also defined:

//Class
public class Employee
{
    //Properties    
    public string Id { get; set; }
    public string Prename { get; set; }
    public string Name { get; set; }
    public string Initials { get; set; }
}

How does the parsing work now, if I by example want now to pass the xml to a method and want to have a List (of Type Employees) with these 3 Employees?

I started by doing something like that:

public List<Employee> GetEmployees(string xml)
{
    using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
    {

    }
}

But Actually I don’t know how to iterate over all these “dicts” which describe one Employee and generally how to deal with.. Help would be appreciated.

  • 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-12T04:59:53+00:00Added an answer on June 12, 2026 at 4:59 am

    Use LINQ2XML..It’s COOL

    XElement doc=XElement.Parse(".......");
    
    var yourList=doc.Descendants("dict").Descendants("dict").Select(
    x=>new Employee
    {
    Id=x.Elements("string").ElementAt(0).Value,
    Prename=x.Elements("string").ElementAt(1).Value,
    Name=x.Elements("string").ElementAt(2).Value,
    Initials=x.Elements("string").ElementAt(3).Value
    }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, say I have the following xml in a string: <?xml version=1.0 encoding=UTF-8?>
I have the following XML example <?xml version=1.0?> <test> <items> <item>item 1</item> <item>item 2</item>
I have the following XML: <?xml version=1.0?> <coll xmlns=http://www.example.org/coll xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.example.org/coll coll.xsd> <collection> <item
I have the following (as an example) XML file and XSD. <?xml version=1.0 encoding=utf-8
I have the following XML file: <?xml version=1.0?> <!DOCTYPE library SYSTEM library.dtd> <library xmlns=http://example.com/a
So I have the following XML chain: $xml->assessment->outcomes_processing->outcomes->decvar->attributes()->cutvalue XML example In Some XML-files $xml->assessment->outcomes_processing->outcomes->...
I have the following in an XML file: <entry> ... <link href=http://www.example.com/somelink /> ...
Given the following XML file: <?xml version=1.0 encoding=UTF-8?> <process name=TestSVG2 xmlns=http://www.example.org targetNamespace=http://www.example.org xmlns:xsd=http://www.w3.org/2001/XMLSchema> <sequence>
I have the following (example) of my xml document: <Students> <Student ID = *GUID
Lets say I have a schema that defines the following XML: <Values> <Add Key=Key1>Value

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.