Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reading enclosure tags with SyndicationFeed

Posted on 2009-05-03
4
Medium Priority
?
11,117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 111

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 111

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

688 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