title: Cannot find item name C# XML
body: <p>I'm having a problem with my XML document.</p>
  
  <p>I want my program to find all values of the items in my XML file, but only if the handlingType is of a certain character bunch.</p>
  
  <p>Code (C#) :  </p>
  
  <pre><code>string path = "//files//handling.meta";
  
               var doc = XDocument.Load(path);
  
              var items = doc.Descendants("HandlingData").Elements("Item");
  
              var query = from i in items
  
                          select new
                           {
                               HandlingName = (string)i.Element("handlingName"),
                               HandlingType = (string)i.Element("HandlingType"),
                               Mass = (decimal?)i.Element("fMass")
                           };
              foreach (var HandlingType in items)
              {
                  if (HandlingType.ToString() == "HANDLING_TYPE_FLYING")
                  {
                      MessageBox.Show(HandlingType.ToString());
                  }
              }
  </code></pre>
  
  <p>The above code demonstraights a short version of what I want to happen, but fails to find this handlingType (does not show the messageBox)</p>
  
  <p>Here's the XML : </p>
  
  <pre><code>&lt;CHandlingDataMgr&gt;
      &lt;HandlingData&gt;
          &lt;Item type="CHandlingData"&gt;
              &lt;handlingName&gt;Plane&lt;/handlingName&gt;
              &lt;fMass value="380000.000000"/&gt;
              &lt;handlingType&gt;HANDLING_TYPE_FLYING&lt;/handlingType&gt;
          &lt;/Item&gt;
          &lt;Item type="CHandlingData"&gt;
              &lt;handlingName&gt;Car1&lt;/handlingName&gt;
              &lt;fMass value="150000.000000"/&gt;
              &lt;handlingType&gt;HANDLING_TYPE_DRIVING&lt;/handlingType&gt;
          &lt;/Item&gt;
      &lt;/HandlingData&gt;
  &lt;/CHandlingDataMgr&gt;
  </code></pre>
  
  <p>I would like the output to show the handlingName if it contains a certain HandlingType
  For e.g. </p>
  
  <pre><code>if (handlingType == "HANDLING_TYPE_FLYING") 
  {
      messageBox.Show(this.HandlingName);
  }
  </code></pre>
  
  <p>My problem in short : Program does not find item's handling type, it does find the tag but when asked to display, returns empty/shows as nothing.</p>
  
  <p>Edit: Also in the XML handling_type_flying contains extra elements such as thrust that cannot be found in each item (such as car), I would like the program to also find these elements. (this is a second problem I'm facing, maybe should ask 2nd ques?)</p>