Difference between revisions of "Rssread.cs"
From AdonaiMedrado.Pro.Br
(New page: <code lang="csharp"> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Net; using System.IO; namespace rssread { cl...) |
|||
Line 14: | Line 14: | ||
static void Main(string[] args) | static void Main(string[] args) | ||
{ | { | ||
− | string s | + | string s; |
do | do |
Latest revision as of 04:14, 3 June 2009
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Net; using System.IO; namespace rssread { class Program { static void Main(string[] args) { string s; do { s = Console.ReadLine(); if (!string.IsNullOrEmpty(s)) { DataSet ds = new DataSet(); WebClient wc = new WebClient(); StringReader sr = new StringReader(wc.DownloadString(s)); ds.ReadXml(sr); Console.WriteLine(ds.Tables["channel"].Rows[0]["title"]); ; for (int i = 0; i < ds.Tables["item"].Rows.Count; i++) { DataRow row = ds.Tables["item"].Rows[i]; Console.WriteLine("\t" + i + " " + row["title"]); if (!string.IsNullOrEmpty((string)row["description"])) Console.WriteLine("\t\t" + row["description"]); } wc.Dispose(); sr.Dispose(); ds.Dispose(); } } while (!string.IsNullOrEmpty(s)); } } }