![]() |
Click here to advertise with us
|
|
|||
|
I've been writing a fairly simple RSS Reader... more for practice than any other reason however I found a really interesting problem that I haven't been able to get around.
Most of the feeds work fine and my app is able to pull a list of items. However a couple of feeds do not pull any items. When looking at the raw XML of the feeds they look essentially identical... but in these cases no data (items) are pulled. To make it a bit more difficult, 2 of the feeds are from the same "blog" site. One works, one doesn't. Feed yields items GM-VOLT : Chevy Volt Electric Car Site Feed does not yield any items 24 boxes Test app to illustrate this: Imports System.Xml Imports System.Net Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myRequest As WebRequest = System.Net.WebRequest.Create("http://feeds.feedburner.com/Gm-volt?format=xml") 'Dim myRequest As WebRequest = System.Net.WebRequest.Create("http://feeds.feedburner.com/24Boxes?format=xml") Dim myResponse As WebResponse = myRequest.GetResponse() Dim rssStream As Stream = myResponse.GetResponseStream() Dim rssDoc As New XmlDocument() rssDoc.Load(rssStream) Dim rssItems As XmlNodeList = rssDoc.SelectNodes("rss/channel/item") MsgBox("item count = " & rssItems.Count) End End Sub End Class For the first feed (comment/uncomment two test lines) I get a number (usually 10), for the second feed it always returns zero. Anyone seen this before? Any ideas why I'm getting data from one feed and not the other? The feeds are generated by the same site so I would expect my code to work either way. |
|
||||
|
One of them is a Rss feed, the other is a Atom feed, Atom (standard) - Wikipedia, the free encyclopedia, different Xml structure.
You don't need to use a WebRequest, use the url directly with xmldoc.Load.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Thanks... while still trying to find a solution, after posting, I stumbled upon that realization my self and have been researching the differences.
I'll try your recommendation and see what I can get. |
|
|||
|
Looks like you're using VB 8.0 as well but this process looks to be greatly simplified in VB 9.0 with System.ServiceModel.Syndication.
Consume RSS/Atom Feeds In VB.Net 9.0 - Home |
|
||||
|
That is great, the Syndication namespace was new to me. It seems to work well with both these feeds.
It doesn't support older rss (rdf) though, some feeds still use this format. The RSS.Net library does, but without Atom support. There's also this article Syndicating and Consuming RSS 1.0 (RDF) Feeds in ASP.NET 3.5 that has a library for Rss10FeedFormatter, but it won't work with the simple SyndicationFeed.Load call for reading any feed.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
![]() |
| Bookmarks |
| Tags |
| rss, xml |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|