I am using this function public static
IList<Item> ParseAtom(string url)
{
try
{
XDocument doc = XDocument.Load(url);
// Feed/Entry
var entries = from item in doc.Root.Elements().Where(i => i.Name.LocalName == "entry")
select new Item
{
FeedType = FeedType.Atom,
Content = item.Elements().First(i => i.Name.LocalName == "content").Value,
Link = item.Elements().First(i => i.Name.LocalName == "link").Attribute("href").Value,
PublishDate = ParseDate(item.Elements().First(i => i.Name.LocalName == "published").Value),
Title = item.Elements().First(i => i.Name.LocalName == "title").Value
};
return entries.ToList();
}
catch
{
return new List<Item>();
}
}
I am using the following link http://localhost/posts.atom/
When i open that link in the browser I see the list of links that direct me to each post item.
- 1 Link 2 Link 3 Link 4 Link
but I when I use it as a url to parse, my program return nothing. I suppose myself that I don't understand what the link above actually means. I really need any of your help to offer me somemore explanation of atom feed, thank you very much .
The XML is created by another file that is stored as a stream as in the following format
<Root>
<Child id=123456>
<Child1>Child1
</Child1>
<Child2>Child2
</Child2>
</Child>
</Root>