Solved

Reading enclosure tags with SyndicationFeed

Posted on 2009-05-03
4
10,251 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 108

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 108

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now