title: Reading XML between two child nodes
body: <p>I'm having a little trouble reading the values of all the sub child nodes between two child nodes. I have a function currently that is "working" but it's not adding the items to a listbox as it's meant to do. I don't get any errors either.</p>
  
  <p>The way the application works is that the name of all the xmls within a folder are added to a combobox once a file is selected in the combobox another combo box is then populated with all the Testcycle numbers that are in that XML. You then select a number within the cmobox box and then click a button and then i want all the values of the attributes filename and hashcode to then be written to a listbox. I.e. if there are 20 filename values and 20 hashcode values there should be 40 items in the listbox.</p>
  
  <p>The only function not working is the adding to listbox one.</p>
  
  <pre><code>void HashMe::AddToListBox()
  {
      String^ SelectedFile = comboBox1-&gt;SelectedItem-&gt;ToString();
      String^ SearchString = "*" + SelectedFile + "*.XML";
      int SelectedTC = int::Parse(comboBox2-&gt;SelectedItem-&gt;ToString());
  
      try
      {
          array&lt;String^&gt;^ FullPaths = IO::Directory::GetFiles("E:\\XML Folder\\", SearchString, System::IO::SearchOption::AllDirectories);
          int number = FullPaths-&gt;GetLength(0);
  
          for (int x = 0; x &lt; number; x++)
          {
              String^ FullPath = FullPaths[x];
  
              XPathNavigator^ Root = XPathDocument(FullPath).CreateNavigator();
              for each (XPathNavigator^ Nav in Root-&gt;Select(L"//TestCycle[@Number = '" + SelectedTC + "']"))
              {
                  listBox4-&gt;Items-&gt;Add(Nav-&gt;GetAttribute(L"FileName",String::Empty)).ToString();
                  listBox4-&gt;Items-&gt;Add(Nav-&gt;GetAttribute(L"HashCode",String::Empty)).ToString();
              }
          }
      }
      catch (Exception^ e)
      {
          MessageBox::Show(e-&gt;ToString());
      }
  }
  </code></pre>
  
  <p>The XML file structure is like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project Name="New"&gt;
    &lt;TestCycle Number="1"&gt;
      &lt;Files&gt;
        &lt;FileName File="C:\Users\brandonm\Documents\asd.xps" /&gt;
        &lt;HashCode Code="AB-B5-85-EC-FE-C4-E2-41-09-6A-A8-77-69-A9-8D-1F" /&gt;
        &lt;FileName File="C:\Users\brandonm\Documents\asdas.xps" /&gt;
        &lt;HashCode Code="7F-30-12-76-C8-80-CA-03-EC-71-12-49-9E-56-9D-D8" /&gt;
        &lt;FileName File="C:\Users\brandonm\Documents\asdasdasd" /&gt;
        &lt;HashCode Code="09-37-69-EF-36-3B-FD-42-D2-37-2D-70-74-A6-ED-BA" /&gt;
      &lt;/Files&gt;
    &lt;/TestCycle&gt;
    &lt;Project Name="New"&gt;
      &lt;TestCycle Number="2"&gt;
        &lt;Files&gt;
          &lt;FileName FileName="C:\Users\brandonm\Documents\asd.xps" /&gt;
          &lt;HashCode HashCode="AB-B5-85-EC-FE-C4-E2-41-09-6A-A8-77-69-A9-8D-1F" /&gt;
          &lt;FileName FileName="C:\Users\brandonm\Documents\asdas.xps" /&gt;
          &lt;HashCode HashCode="7F-30-12-76-C8-80-CA-03-EC-71-12-49-9E-56-9D-D8" /&gt;
          &lt;FileName FileName="C:\Users\brandonm\Documents\asdasd.xps" /&gt;
          &lt;HashCode HashCode="E4-EF-33-AE-24-23-00-37-FD-E2-20-60-5E-68-C0-54" /&gt;
        &lt;/Files&gt;
      &lt;/TestCycle&gt;
    &lt;/Project&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated. I think there may be an issue with my XPath queries. Thanks</p>