I'm trying to parse the xml given below:
<Item status="SUCCESS" message="">
<ItemDate>12/21/2012
<ItemType>MyType1
<ItemUrl title="ItemTitle">http://www.itemurl1.com</ItemUrl>
</ItemType>
</ItemDate>
<ItemDate>12/22/2012
<ItemType>MyType2
<ItemUrl title="Item2Title">http://www.itemurl2.com</ItemUrl>
</ItemType>
</ItemDate>
</Item>
As you could see I'm not sure whether we can call this xml, but this si what I get out of a legacy service. What I'm after is to parse this and load it into an object graph. My object model is as below:
public class Item
{
public string Date { get; set; }
public string Type { get; set; }
public string Url { get; set; }
public string Title { get; set; }
}
So, basically when I'm done with parsing the above xml/string I get a collection of Item objects. Can you please suggest me how to achieve this with some code snippet?
I tried with XDocument, but I was not able to do it given the peculiar structure of xml.
Thanks, -Mike