title: Loop through multiple subnodes in XML
body: <pre><code>  &lt;Sections&gt;
      &lt;Classes&gt;
        &lt;Class&gt;VI&lt;/Class&gt;
        &lt;Class&gt;VII&lt;/Class&gt;
      &lt;/Classes&gt;
      &lt;Students&gt;
        &lt;Student&gt;abc&lt;/Student&gt;
        &lt;Student&gt;def&lt;/Student&gt;
      &lt;/Students&gt;    
    &lt;/Sections&gt;
  </code></pre>
  
  <p>I have to loop through Classes to get 'Class' into an array of strings. I have to also loop through 'Students' to get 'Student' put into an array of strings. </p>
  
  <pre><code>XDocument doc.Load("File.xml");
       string str1;
       foreach(XElement mainLoop in doc.Descendants("Sections")) 
         {   
            foreach(XElement classLoop in mainLoop.Descendants("Classes"))
                  str1 = classLoop.Element("Class").Value +",";
         //Also get Student value
          }
  </code></pre>
  
  <p>is not working to get all the classes. Also, I need to rewrite this <strong>without</strong> using LINQ to XML, i.e using XmlNodeList and XmlNodes. </p>
  
  <pre><code>XmlDocument doc1 = new XmlDocument();
  doc1.Load("File.xml");
  foreach(XmlNode mainLoop in doc.SelectNodes("Sections")) ??
  </code></pre>
  
  <p>Not sure how to go about it.</p>