I have the following xml data:
<portfolio>
<item>
<title>Site</title>
<description>Site.com is a </description>
<url>http://www.site.com</url>
<photos>
<photo url="http://www.site.com/site/thumbnail.png" thumbnail="true" description="Main" />
<photo url="http://www.site.com/site/1.png" thumbnail="false" description="Main" />
</photos>
</item>
</portfolio>
In c# I am using the following link query:
List<PortfolioItem> list = new List<PortfolioItem>();
XDocument xmlDoc = XDocument.Load(HttpContext.Current.Server.MapPath("~/app_data/portfolio.xml"));
list = (from portfolio in xmlDoc.Descendants("item")
select new PortfolioItem()
{
Title = portfolio.Element("title").Value,
Description = portfolio.Element("description").Value,
Url = portfolio.Element("url").Value
}).ToList();
How do I go about querying the photos node? In the PortfolioItem class I have a property:
List<Photo> Photos {get;set;}
Any ideas would be greatly appreciated!