Solved

Reading enclosure tags with SyndicationFeed

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

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 110

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a Dropdown list with sub group 10 43
Trigger C# code inside the SQL Server 6 57
What!!!??? 5 62
SQL State HYT00. Timeout expired proplem 8 44
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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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:
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…

751 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