| | |
A RSS feed reader....
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hiya people been working on a new project.You guessed right a RSS reader for podcasts....I have been able to reach and read text from a sample code I found.But because I am quite a noob I couldn't figured it out how to work it for podcasts...
Here is the code: (Note that I'm currently using .net 2005 and the code you are seeing is the form code...thanks in advance)
program.cs part of the code
Here is the code: (Note that I'm currently using .net 2005 and the code you are seeing is the form code...thanks in advance)
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Xml; namespace RSS_Reader { public partial class frmMain : Form { XmlTextReader rssReader; XmlDocument rssDoc; XmlNode nodeRss; XmlNode nodeChannel; XmlNode nodeItem; ListViewItem rowNews; public frmMain() { InitializeComponent(); } private void btnRead_Click(object sender, EventArgs e) { lstNews.Items.Clear(); this.Cursor = Cursors.WaitCursor; rssReader = new XmlTextReader(txtUrl.Text); rssDoc = new XmlDocument(); rssDoc.Load(rssReader); for (int i = 0; i < rssDoc.ChildNodes.Count; i++) { if (rssDoc.ChildNodes[i].Name == "rss") { nodeRss = rssDoc.ChildNodes[i]; } } for (int i = 0; i < nodeRss.ChildNodes.Count; i++) { if (nodeRss.ChildNodes[i].Name == "channel") { nodeChannel = nodeRss.ChildNodes[i]; } } lblTitle.Text = "Title: " + nodeChannel["title"].InnerText; lblLanguage.Text = "Language: " + nodeChannel["language"].InnerText; lblLink.Text = "Link: " + nodeChannel["link"].InnerText; lblDescription.Text = "Description: " + nodeChannel["description"].InnerText; for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) { if (nodeChannel.ChildNodes[i].Name == "item") { nodeItem = nodeChannel.ChildNodes[i]; rowNews = new ListViewItem(); rowNews.Text = nodeItem["title"].InnerText; rowNews.SubItems.Add(nodeItem["link"].InnerText); lstNews.Items.Add(rowNews); } } this.Cursor = Cursors.Default; } private void lstNews_SelectedIndexChanged(object sender, EventArgs e) { if (lstNews.SelectedItems.Count == 1) { for (int i = 0; i < nodeChannel.ChildNodes.Count; i++) { if (nodeChannel.ChildNodes[i].Name == "item") { nodeItem = nodeChannel.ChildNodes[i]; if (nodeItem["title"].InnerText == lstNews.SelectedItems[0].Text) { txtContent.Text = nodeItem["description"].InnerText; break; } } } } } private void lstNews_DoubleClick(object sender, EventArgs e) { System.Diagnostics.Process.Start(lstNews.SelectedItems[0].SubItems[1].Text); } } }
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.Windows.Forms; namespace RSS_Reader { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new frmMain()); } }
"By the data to date, there is only one animal in the Galaxy dangerous to man—man himself. So he must supply his own indispensable competition. He has no enemy to help him."
From Time Enough for Love by Robert A. Heinlein
From Time Enough for Love by Robert A. Heinlein
![]() |
Similar Threads
- create html file from rss feed (PHP)
- RSS feed doesn't validate but why? (RSS, Web Services and SOAP)
- How do I put a blog RSS feed in PHPBB? (PHP)
- How to use this site's RSS feed? (DaniWeb Community Feedback)
- RSS Feed Readers (Geeks' Lounge)
- RSS Feed (Web Browsers)
Other Threads in the C# Forum
- Previous Thread: Animated gif in picturebox
- Next Thread: GroupBox selection and Winform Clearing
Views: 5068 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms ftp function gcd gdi+ http httpwebrequest image index input install java label list listbox login mandelbrot math mysql networking operator oracle path photoshop picturebox pixelinversion prime programming radians regex remote remoting resource richtextbox save saving serialization server socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view webbrowser windows winforms wpf xml






