Parsing inner nodes from an xml using Linq
<p>This question is a follow up from <a href="http://stackoverflow.com/questions/13878004/parsing-xml-with-inner-nodes?rq=1">this</a>.</p>

<p>When I try to read inner nodes using linq, it does not give me back the collection as expected, but rather gives me only one item. Please see the test.</p>

<pre><code>   [Test]
        public void Should_get_all_items()
        {
            var item = "&lt;Item status=\"SUCCESS\""+
            " message=\"\"&gt;" +
            "&lt;ItemDate&gt;12/21/2012" +
            "&lt;ItemType&gt;MyType1" +
            "&lt;ItemUrl title=\"ItemTitle\"&gt;http://www.itemurl1.com&lt;/ItemUrl&gt;" +
            "&lt;/ItemType&gt;" +
            "&lt;/ItemDate&gt;" +
            "&lt;ItemDate&gt;12/22/2012" +
            "&lt;ItemType&gt;MyType2" +
            "&lt;ItemUrl title=\"Item2Title\"&gt;http://www.itemurl2.com&lt;/ItemUrl&gt;" +
            "&lt;/ItemType&gt;" +
            "&lt;/ItemDate&gt;" +
            "&lt;/Item&gt;";

            XDocument xdoc = XDocument.Parse(item);
            var query = from i in xdoc.Descendants("Item")
                        let date = i.Element("ItemDate")
                        let type = date.Element("ItemType")
                        let url = type.Element("ItemUrl")
                        select new ItemDate()
                        {
                            Date = ((XText)date.FirstNode).Value,
                            Type = ((XText)type.FirstNode).Value,
                            Url = (string)url,
                            Title = (string)url.Attribute("title"),
                        };

            var qItems = query.ToList();
            Assert.That(qItems.Count, Is.EqualTo(2));
        }

 public class ItemDate
    {
        public string Date { get; set; }
        public string Type { get; set; }
        public string Url { get; set; }
        public string Title { get; set; }
    }
</code></pre>

<p>The above test fails.Any idea what is going wrong here? I think the name Item is bit misleading here as I'm after the collection of ItemDates</p>

<p>Thanks,
-Mike</p>
