Solved

Reading enclosure tags with SyndicationFeed

Posted on 2009-05-03
4
10,475 Views
Last Modified: 2013-11-18
Hi All,

I am trying to read enclousre tags content inside item elements in rss feeds. I could easly retrive stardart rss 2.0 feeds by SyndicationFeed class. But I could not get enclosure tags content.

In the code section you could see what I mean.

Here is an example rss that I try to read..
http://www.nydailynews.com/rss.xml

it have enclosure tags inside item tags and these comes from  xmlns:media="http://search.yahoo.com/mrss/" extension.

I do not want to parse these xml diretly. 0s there a way to read these rss content by using .NET Framework Class Library
SyndicationFeed Class. In the code section there is the standart code that I use to get rss feeds.



SyndicationFeed feed = FeedReader.LoadFrom("http://www.nydailynews.com/rss.xml");
 
            foreach (SyndicationItem item in feed.Items)
            {
                //...what must I do to get enclosure content like image url..
            }

Open in new window

0
Comment
Question by:karanba
  • 2
  • 2
4 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 24290796
I can show you how to do this quite easily in PHP.  Would that be useful? ~Ray
0
 

Author Comment

by:karanba
ID: 24290930
No thanks.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 24290941
Quel Fromage.  Good luck with it.

If you feel that this does not get a good answer fairly soon, delete the question and repost it.  Some Experts will overlook a question once it has a few posts because they assume it is getting an answer.  Obviously that is not the case here.  I will not object to the deletion, and your points will be refunded.

Best regards, ~Ray
0
 

Accepted Solution

by:
karanba earned 0 total points
ID: 24291051
I found the answer..

The following code do what I need exactly



   foreach (SyndicationLink enclosure in syndicationItem.Links.Where<SyndicationLink>(x => x.RelationshipType == "enclosure"))
                        {
                            Uri url = enclosure.Uri;
                            long length = enclosure.Length;
                            string mediaType = enclosure.MediaType;
                        }

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to count occurrences of each item in an array.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question