XmlTextReader & CNN RSS Feed

S

sck10

Hello,

I am using the following to get RSS Feeds. I've been able to get the xml
files from every site except CNN. When I try to get there feed, I get the
exception:

A column named 'link' already belongs to this DataTable: cannot set a nested
table name to the same name.

Any help with this would be appreciated. Thanks, sck10


try
{
WebRequest req =
WebRequest.Create(http://rss.cnn.com/rss/cnn_topstories.rss);

// Get Website Proxy
req.Proxy = new WebProxy("global.proxy.lucent.com:8000", true);
req.Proxy.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();

// Stream the data
StreamReader textReader = new StreamReader(resp.GetResponseStream());
XmlTextReader xmlReader = new XmlTextReader(textReader);
//XmlReader rssReader = new XmlTextReader(rssUrl);

// Build Dataset
DataSet dsRSS = new DataSet();
dsRSS.ReadXml(xmlReader);

// Populate Repeater Tool
rptRSS.DataSource = dsRSS.Tables["item"];
rptRSS.DataBind();
}

catch(Exception ex)
{
this.pnlMessage.Visible = true;
this.lblMessageTitle.Text = "RSS Feed Error";
this.lblMessageText.Text =
"<span class=BlkB>Record Not Found</span><br />" +
"Problems consuming RSS Feed for" +
"<br /><br /><span class=BlkB>RSS Feed Error</span><br />" +
ex.Message.ToString();
}
 
W

Walter Wang [MSFT]

Hi sck10,

RSS feed is valid xml, but not necessary valid for a dataset.

If your purpose is to display RSS feeds on your webpage, I would recommend
some well built custom controls:

#RssFeed
http://scottonwriting.net/sowBlog/RssFeed.htm

#Awesome ASP.NET 2.0 RSS Tool-Kit
http://weblogs.asp.net/scottgu/archive/2006/02/22/438738.aspx

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

sck10

Hi Walter,

I downloaded the RSS Toolkit. Do you know how to set the web proxy for
this?

Thanks,
sck10
 
W

Walter Wang [MSFT]

Hi sck10,

Currently the toolkit didn't expose a method or property to let you specify
a proxy when it downloads the rss. Fortunately, we have the source code so
it should be easy to add this. In RssDownloadManager.cs:

RssChannelDom DownloadChannelDom(string url) {
// look for disk cache first
RssChannelDom dom = TryLoadFromDisk(url);

if (dom != null) {
return dom;
}

// download the feed
byte[] feed = new WebClient().DownloadData(url);


You can refer to WebClient.Proxy documentation on how to add proxy support:

#WebClient.Proxy Property (System.Net)
http://msdn2.microsoft.com/en-us/library/system.net.webclient.proxy.aspx

Please let me know if you need more information on this.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top