i am trying to parse following xml but no sucess any one guide me what mistake am i doing here
string feedURL = "http://www.bbc.co.uk/arabic/index.xml";
XDocument feedSource;
feedSource = XDocument.Load(feedURL);
var another = (from myFeed in feedSource.Descendants("entry")
select new
{
feedTitle = myFeed.Element("title").Value,
//feedDescription = myFeed.Element("description").Value,
//feedLink = myFeed.Element("link").Value,
feedpubDate = myFeed.Element("published") != null ? myFeed.Element("published").Value : null
//feedcategory = myFeed.Element("category") != null ? myFeed.Element("category").Value : null,
//feedItems = myFeed.Descendants("entry")
}
);
if (another != null && another.Count() > 0)
{
}
else
{
Response.Write("No Record Found");
}
it is showing me no record found.
any help would be appreciated.
This worked in LINQPad:
Problem was the lacking namespace.