Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Parse the following XML, not sure how
    text
    copied!<p>I have by example following XML:</p> <pre><code>string xml = @"&lt;plist version='1.0'&gt; &lt;dict&gt; &lt;key&gt;DataType&lt;/key&gt; &lt;string&gt;Employee&lt;/string&gt; &lt;key&gt;8000&lt;/key&gt; &lt;dict&gt; &lt;key&gt;Id&lt;/key&gt; &lt;string&gt;8000&lt;/string&gt; &lt;key&gt;Prename&lt;/key&gt; &lt;string&gt;Walter&lt;/string&gt; &lt;key&gt;Name&lt;/key&gt; &lt;string&gt;Walter Lohner Stans&lt;/string&gt; &lt;key&gt;Initials&lt;/key&gt; &lt;string&gt;MAL&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;8001&lt;/key&gt; &lt;dict&gt; &lt;key&gt;Id&lt;/key&gt; &lt;string&gt;8001&lt;/string&gt; &lt;key&gt;Prename&lt;/key&gt; &lt;string&gt;Motorrad&lt;/string&gt; &lt;key&gt;Name&lt;/key&gt; &lt;string&gt; Meierskappel&lt;/string&gt; &lt;key&gt;Initials&lt;/key&gt; &lt;string&gt;MAM&lt;/string&gt; &lt;/dict&gt; &lt;key&gt;8004&lt;/key&gt; &lt;dict&gt; &lt;key&gt;Id&lt;/key&gt; &lt;string&gt;8004&lt;/string&gt; &lt;key&gt;Prename&lt;/key&gt; &lt;string&gt;Hanspeter&lt;/string&gt; &lt;key&gt;Name&lt;/key&gt; &lt;string&gt;Altenbürger AG Horgen&lt;/string&gt; &lt;key&gt;Initials&lt;/key&gt; &lt;string&gt;FH&lt;/string&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/plist&gt;"; </code></pre> <p>I would like to get these 3 Employees as a List...</p> <p>The Class Employee is also defined:</p> <pre><code>//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; } } </code></pre> <p>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?</p> <p>I started by doing something like that:</p> <pre><code>public List&lt;Employee&gt; GetEmployees(string xml) { using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { } } </code></pre> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload