title: Parsing XML data in C# and show into ListBox
body: <p>I am trying to parse a XML file in C# using Visual Studio and show the data in a ListBox, but I don't know how to parse it when I'm dealing with a nested XML file.</p>
  
  <p>This is the code from the XML file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;!DOCTYPE root [
    &lt;!ELEMENT root (Persons*)&gt;
    &lt;!ELEMENT Persons (name)&gt;
    &lt;!ELEMENT IsMale (#PCDATA)&gt;
    &lt;!ELEMENT Age (#PCDATA)&gt;
    &lt;!ELEMENT Name (#PCDATA)&gt;
    &lt;!ELEMENT LikedPerson (name)&gt;
   ]&gt;
  &lt;root&gt;
    &lt;Persons name ="Bob"&gt;
      &lt;IsMale&gt;true&lt;/IsMale&gt;
      &lt;Age&gt;30&lt;/Age&gt;
      &lt;LikedPerson name ="Iulia"&gt;
        &lt;IsMale&gt;false&lt;/IsMale&gt;
        &lt;Age&gt;32&lt;/Age&gt;
      &lt;/LikedPerson&gt;
    &lt;/Persons&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The code I've written in C# successfully return me only the name, gender and age for every person, but I don't know how to write to show me also the person_liked:</p>
  
  <pre><code>private void LoadPersons()
      {
          XmlDocument doc = new XmlDocument();
          doc.Load("Baza_de_cunostinte.xml");
  
          foreach (XmlNode node in doc.DocumentElement) 
          {
              string name = node.Attributes[0].Value;
              int age = int.Parse(node["Age"].InnerText);
              bool isMale = bool.Parse(node["IsMale"].InnerText);
  
  //          Persons likedPerson.name = Persons.node.Attributes[0].Value ?  
  //          .....
  
              listBox.Items.Add(new Persons(name, age, isMale, likedPerson));
          }
      }
  
      private void listBox_SelectedIndexChanged(object sender, EventArgs e)
      {
          if (listBox.SelectedIndex != -1)
          {
              propertyGrid1.SelectedObject = listBox.SelectedItem;
          }
      }
  </code></pre>
  
  <p>This is the definition of the Persons.cs :</p>
  
  <pre><code>class Persons
  {
      public string Name { get; private set; }
      public int Age { get; private set; }
      public bool IsMale { get; private set; }
      public Persons LikedPerson { get; private set; }
  
      public Persons(string name, int age, bool isMale, Persons likedPerson)
      {
          Name = name;
          Age = age;
          IsMale = isMale;
          LikedPerson = likedPerson;
      }
  }
  </code></pre>