title: LINQ to XML select element from specific node/nodes
body: <p>I have an XML file and would like to create objects based on the content of the file. The XML file looks like:   </p>
  
  <pre><code>&lt;DefaultView&gt;
      &lt;Module&gt;
        &lt;Variable Name="gTestInt1" Enable="True" /&gt;
        &lt;Task Name="Task1"&gt;
          &lt;Variable Name="testInt" Enable="True" /&gt;
          &lt;Variable Name="testReal" Enable="True" /&gt;
          &lt;Variable Name="testString" Enable="True" /&gt;
        &lt;/Task&gt;
        &lt;Task Name="Task2"&gt;
          &lt;Variable Name="testInt1" Enable="True" /&gt;
          &lt;Variable Name="testReal" Enable="True" /&gt;
          &lt;Variable Name="testString" Enable="True" /&gt;
        &lt;/Task&gt;
      &lt;/Module&gt;
  &lt;/DefaultView&gt;
  </code></pre>
  
  <p>My LINQ statement is the following:</p>
  
  <pre><code>var globalVariables = (from cfg in _xElements.Descendants("Module").Descendants("Variable")
                        select new Variable
                        {
                            Name = cfg.Attribute("Name").Value,
                            Enable = bool.Parse(cfg.Attribute("Enable").Value)
                        }).ToList(); 
  </code></pre>
  
  <p>So my problem is that I get all the Variable objects that are in the XML file, including the the ones in the child nodes (Task).
  But I just want the Variable objects that are not in any child node. Just the ones in the Module node.</p>
  
  <p>How must my LINQ query look like to get this?</p>