title: Getting attribute value using XElement
body: <p>I have an xml file like this</p>
  
  <pre><code>&lt;Program xmlns="CBOpenIFSchema3_0"&gt;
      &lt;Variables/&gt;
      &lt;CodeBlocks&gt;
          &lt;CodeBlock Name="Code1"&gt;
              &lt;Code&gt;
                  Sample code 1
              &lt;/Code&gt;
          &lt;/CodeBlock&gt;
          &lt;CodeBlock Name="Code2"&gt;
              &lt;Code&gt;
                  Sample code 2
              &lt;/Code&gt;
          &lt;/CodeBlock&gt;
          &lt;CodeBlock Name="Code3"&gt;
              &lt;Code&gt;
                  Sample code 3
              &lt;/Code&gt;
          &lt;/CodeBlock&gt;
      &lt;/CodeBlocks&gt;
  &lt;/Program&gt;
  </code></pre>
  
  <p>From this xml I need to get the name of each codeblock and the code corresponding to it. How can this be done using XElement? I tried using the following.</p>
  
  <pre><code>XElement xDoc = XElement.Load("test.xml");
  IEnumerable&lt;XElement&gt; codeBlocks = xDoc.Descendants("CodeBlocks").Elements();
  foreach (var c in codeBlocks)
      Console.WriteLine(c.Attribute("Name").Value);
  </code></pre>
  
  <p><code>codeBlocks</code> is showing <code>"Enumeration yielded no results"</code>.</p>
  
  <p>Edit: <code>xmlns="CBOpenIFSchema3_0"</code> gives the problem.</p>