title: Parsing xml attribute value from specified node area
body: <p>I have an XML which follow the following structure:</p>
  
  <pre><code>&lt;model uir="model1"&gt;
   &lt;profile&gt;
    &lt;profiles&gt;
     &lt;timeseries&gt;
       &lt;value double="24.7" index="2011-01-01 00:00" /&gt;
       &lt;value double="24.5" index="2011-01-02 00:00" /&gt;
       &lt;value index="2011-04-23 00:00" /&gt; //Here for some reason i must have double=null
       &lt;value index="2011-04-24 00:00" /&gt;
       &lt;value double="24.7" index="2011-01-01 00:00" /&gt;
       &lt;value double="24.5" index="2011-01-02 00:00" /&gt;
  
      &lt;/timeseries&gt;
     &lt;/profile&gt;
    &lt;/profiles&gt;
   &lt;/model&gt;
  &lt;model uir="model2"&gt;
   &lt;profile&gt;
    &lt;profiles&gt;
     &lt;timeseries&gt;
       &lt;value double="24.7" index="2011-01-01 00:00" /&gt;
       &lt;value double="24.5" index="2011-01-02 00:00" /&gt;
       &lt;value index="2011-04-23 00:00" /&gt; //Here for some reason i must have double=null
       &lt;value index="2011-04-24 00:00" /&gt;
       &lt;value double="24.7" index="2011-01-01 00:00" /&gt;
       &lt;value double="24.5" index="2011-01-02 00:00" /&gt;
  
      &lt;/timeseries&gt;
     &lt;/profile&gt;
    &lt;/profiles&gt;
   &lt;/model&gt;
  </code></pre>
  
  <p>This that i want is to take the value of the attribute <strong>double</strong> and to store it in a list (or vector) for each model. When the node <strong>value</strong> hasn't an attribute double to insert a null. In first level i tried the following but when it reaches in a node with no attribute double stack. </p>
  
  <pre><code>using System;
  using System.Linq;
  using System.Xml;
  using System.Xml.Linq;
  
  class MyClass
  {
     static void Main(string[] args)
     {
          string file = @"C:\RDMS.xml";
          XDocment doc = XDocument.Load(file);
          foreach (var item in doc.Descendants("value"))
          {
              Console.WriteLine(item.Attribute("double").Value);
          }
         Console.ReadKey();
     }
  } 
  </code></pre>