Solved

Reading enclosure tags with SyndicationFeed

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Needing an event fired when a row is added on a datagridview 4 37
C# Offline Apllication 5 56
ASP.NET 5 Templates 2 68
Ajax Panel Not Updating When Triggered By Timer 4 46
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

863 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

22 Experts available now in Live!

Get 1:1 Help Now