Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > Database > XML

XML All about XML here

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2009, 12:35 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jul 2009
Posts: 2
Reputation: 0
TGImages is on a distinguished programming path ahead
Default RSS app sometimes works

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-01-2009, 1:39 PM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

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.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-01-2009, 2:21 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jul 2009
Posts: 2
Reputation: 0
TGImages is on a distinguished programming path ahead
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-01-2009, 3:01 PM
VB.NET Forum Idol
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Feb 2008
Location: USA
Posts: 877
Reputation: 499
MattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond repute
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-03-2009, 6:52 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

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.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
rss, xml


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 5:57 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.