title: XML full file reading C#
body: <p>So I have a code that reads partially into an XML document, precenting me with the first block of results which is great, but I have a file containing multiple blocks of the same code &amp; my program seems to quit after the first.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>string path = "data//handling.meta";
  var doc = XDocument.Load(path);
  var items = doc.Descendants("HandlingData").Elements("Item");//.ToArray();
  var query = from i in items
              select new 
              {
                  HandlingName = (string)i.Element("handlingName"),
                  Mass = (decimal?)i.Element("fMass").Attribute("value"), 
                  InitialDragCoeff = (decimal?)i.Element("fInitialDragCoeff").Attribute("value"), 
                  PercentSubmerged = (decimal?)i.Element("fPercentSubmerged").Attribute("value"), 
                  DriveBiasFront = (decimal?)i.Element("fDriveBiasFront").Attribute("value"), 
                  InitialDriveGears = i.Element("nInitialDriveGears").Attribute("value")
              }
  string test = ("{0} - {1}" + query.First().HandlingName + query.First().Mass + query.First().InitialDragCoeff);
  richTextBox1.Text = test;
  </code></pre>
  
  <p>Here's the XML Document :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;CHandlingDataMgr&gt;
    &lt;HandlingData&gt;
      &lt;Item type="CHandlingData"&gt;
        &lt;handlingName&gt;Car1&lt;/handlingName&gt;
        &lt;fMass value="140000.000000" /&gt;
        &lt;fInitialDragCoeff value="30.000000" /&gt;
        &lt;fPercentSubmerged value="85.000000" /&gt;
        &lt;vecCentreOfMassOffset x="0.000000" y="0.000000" z="0.000000" /&gt;
        &lt;vecInertiaMultiplier x="1.000000" y="1.000000" z="1.000000" /&gt;
        &lt;fDriveBiasFront value="1.000000" /&gt;
        &lt;nInitialDriveGears value="1" /&gt;
      &lt;/Item&gt;
      &lt;Item type="CHandlingData"&gt;
        &lt;handlingName&gt;Car2&lt;/handlingName&gt;
        &lt;fMass value="180000.000000" /&gt;
        &lt;fInitialDragCoeff value="7.800000" /&gt;
        &lt;fPercentSubmerged value="85.000000" /&gt;
        &lt;vecCentreOfMassOffset x="0.000000" y="0.000000" z="0.000000" /&gt;
        &lt;vecInertiaMultiplier x="1.000000" y="1.300000" z="1.500000" /&gt;
        &lt;fDriveBiasFront value="0.200000" /&gt;
        &lt;nInitialDriveGears value="6" /&gt;
      &lt;/Item&gt;
   &lt;/HandlingData&gt;
  &lt;/CHandlingDataMgr&gt;   
  </code></pre>
  
  <p>As shown, there's multiple handling Name's. The CSharp code above does work, but only for the first block &amp; I'm wondering how to make it read the same values from the different handling name. </p>
  
  <p>I have tried :</p>
  
  <pre><code>if (query.First().HandlingName == "Car2")
  {
      MessageBox.Show("Car 2 found");
  }
  </code></pre>
  
  <p>but since the message box never appeared, I assume this code doesn't read the hole file? </p>
  
  <p>I'm hoping for output like this:</p>
  
  <pre><code>Name: Car 1 
  Mass: 140000.000000
  InitialDragCoeff: 30.000000
  
  Name: Car 2
  Mass: 180000.000000
  InitialDragCoeff: 7.800000
  </code></pre>
  
  <p>My problem in a 'nut shell' : Program does not see Car 2</p>
  
  <p>Any help would be really appreciated, as I've tried many solutions &amp; read many pages regarding XML today</p>