title: Reading xml tag by tag C#
body: <p>I am reading tags of an XML file in c#,the code I have reads to the end of the file,but I want to read it tag by tag.In fact,I want to have a List in which every tag is saved.
  Here is my xml:</p>
  
  <pre><code>&lt;XML&gt;
  &lt;Groups&gt;
   &lt;Group Name="Group1" ID="D7EBC5D6-0E6D-499E-B528-34BE14382755"&gt;
      &lt;Item ID="9A4FA56F-EAA0-49AF-B7F0-8CA09EA39167"/&gt;
      &lt;Item ID="351FEF76-B826-426F-88C4-DBAAA60F886B"/&gt;
      &lt;Item ID="96A4CBFC-04CD-4D27-ADE6-585C05E4DBC9"/&gt;
      &lt;Item ID="D8876943-5861-4D62-9249-C5FEF88219FA"/&gt;
  &lt;/Group&gt;
  &lt;Group Name="Group2" ID="CC012258-14AC-44E9-BA0F-78AE7C569FCB"&gt;
      &lt;Item ID="9A4FA56F-EAA0-49AF-B7F0-8CA09EA39167"/&gt;
      &lt;Item ID="351FEF76-B826-426F-88C4-DBAAA60F886B"/&gt;
  &lt;/Group&gt;
  &lt;/Groups&gt;
   &lt;Items&gt;
  &lt;Item&gt;
      &lt;GUID&gt;9A4FA56F-EAA0-49AF-B7F0-8CA09EA39167&lt;/GUID&gt;
      &lt;Type&gt;button&lt;/Type&gt;
      &lt;Title&gt;Save&lt;/Title&gt;
      &lt;Value&gt;submit&lt;/Value&gt;
      &lt;Name&gt;btnsave&lt;/Name&gt;
      &lt;MaxLen&gt;5&lt;/MaxLen&gt;
  &lt;/Item&gt;    
  &lt;Item&gt;
      &lt;GUID&gt;351FEF76-B826-426F-88C4-DBAAA60F886B&lt;/GUID&gt;
      &lt;Type&gt;text&lt;/Type&gt;
      &lt;Title&gt;Name:&lt;/Title&gt;
      &lt;Name&gt;txtname&lt;/Name&gt;
      &lt;Value&gt;Name&lt;/Value&gt;
      &lt;MaxLen&gt;2&lt;/MaxLen&gt;
  &lt;/Item&gt;
  &lt;/Items&gt;
  &lt;/XML&gt;
  </code></pre>
  
  <p>And my C# code:</p>
  
  <pre><code>    public Guid GroupsGuid;
      public Guid ItemsGuid;
      List&lt;Guid&gt; ItemsIndex = new List&lt;Guid&gt;();
      public string Datastring;        
  
      public override void LoadFromXML(string XMLFileAddress)
      {
          XmlTextReader reader = new XmlTextReader(XMLFileAddress);                      
          while (reader.Read())
          {
              switch (reader.Name)
              {
                  case "Groups":
                      while (reader.Read())
                      {
                          if (reader.NodeType == XmlNodeType.EndElement)
                              break;
                          switch (reader.Name)
                          {
                              case "Group":
                                  GroupsGuid=Guid.Parse(reader.GetAttribute("ID"));
                                  Datastring += "&lt;" + reader.Name + " name = " + reader.GetAttribute("Name") + " ID = " + GroupsGuid + "/&gt;";
                                  while (reader.Read())
                                  {
                                      if (reader.NodeType == XmlNodeType.EndElement)
                                          break;
                                      switch (reader.Name)
                                      {
                                          case "Item":
                                              ItemsGuid = Guid.Parse(reader.GetAttribute("ID"));
                                              Datastring += "&lt;" + reader.Name + " ID = " + reader.GetAttribute("ID") + "/&gt;";                                                
                                              ItemsIndex.Add(GroupsGuid);
                                              break;
                                      }
                                  }
                                  break;
                          }
                      }
                      reader.Close();
                      break;
              }
          }
      }
  </code></pre>
  
  <p>I want to see the tags as on object in my program.
  Thank you in advance.</p>