Best Way to read rss feed in .net Using C# [closed]

Add System.ServiceModel in references Using SyndicationFeed: string url = “http://fooblog.com/feed”; XmlReader reader = XmlReader.Create(url); SyndicationFeed feed = SyndicationFeed.Load(reader); reader.Close(); foreach (SyndicationItem item in feed.Items) { String subject = item.Title.Text; String summary = item.Summary.Text; … }

Using SimpleXML to read RSS feed

As you already know, SimpleXML lets you select an node’s child using the object property operator -> or a node’s attribute using the array access [‘name’]. It’s great, but the operation only works if what you select belongs to the same namespace. If you want to “hop” from a namespace to another, you can use … Read more

How to write an RSS feed with Java?

I recommend using Rome: // Feed header SyndFeed feed = new SyndFeedImpl(); feed.setFeedType(“rss_2.0”); feed.setTitle(“Sample Feed”); feed.setLink(“http://example.com/”); // Feed entries List entries = new ArrayList(); feed.setEntries(entries); SyndEntry entry = new SyndEntryImpl(); entry.setTitle(“Entry #1”); entry.setLink(“http://example.com/post/1”); SyndContent description = new SyndContentImpl(); description.setType(“text/plain”); description.setValue(“There is text in here.”); entry.setDescription(description); entries.add(entry); // Write the feed to XML StringWriter writer = … Read more

How to parse an RSS feed using JavaScript?

Parsing the Feed With jQuery’s jFeed (Don’t really recommend that one, see the other options.) jQuery.getFeed({ url : FEED_URL, success : function (feed) { console.log(feed.title); // do more stuff here } }); With jQuery’s Built-in XML Support $.get(FEED_URL, function (data) { $(data).find(“entry”).each(function () { // or “item” or whatever suits your feed var el = … Read more

Parse RSS with jQuery

WARNING The Google Feed API is officially deprecated and doesn’t work anymore! No need for a whole plugin. This will return your RSS as a JSON object to a callback function: function parseRSS(url, callback) { $.ajax({ url: document.location.protocol + ‘//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=’ + encodeURIComponent(url), dataType: ‘json’, success: function(data) { callback(data.responseData.feed); } }); }

How to apply CSS to iframe?

Edit: This does not work cross domain unless the appropriate CORS header is set. There are two different things here: the style of the iframe block and the style of the page embedded in the iframe. You can set the style of the iframe block the usual way: <iframe name=”iframe1″ id=”iframe1″ src=”https://stackoverflow.com/questions/217776/empty.htm” frameborder=”0″ border=”0″ cellspacing=”0″ … Read more

how to display only 5 records?

the easiest way would be to stop your loop after 5 iterations: $i = 0; foreach($x->channel->item as $entry) { // do something $i++; if($i==5){ break; } } another (more beautiful) way would be to use a for-loop instead of foreach: for($i=0; $i<=min(5, count($x->channel->item)); $i++) { $entry = $x->channel->item[$i]; // do something } EDIT : thanks … Read more