I am trying to get the html for this link http://slashdot.org/firehose.pl?op=rss&content_type=rss&orderby开发者_如何转开发=createtime&fhfilter="home:vamsivanka"
Dim myRequest As WebRequest
Dim myResponse As WebResponse
Try
myRequest = System.Net.WebRequest.Create(url)
myRequest.Timeout = 10000
myResponse = myRequest.GetResponse()
Dim rssStream As Stream = myResponse.GetResponseStream()
Dim rssDoc As New XmlDocument()
rssDoc.Load(rssStream)
Catch ex As Exception
End Try
But the rssDoc.Load is giving me an error '--' is an unexpected token. The expected token is '>'. Line 81, position 5.
Please Let me know your suggestions.
Actually, it appears the issue that you're getting is because you have to be logged in to slashdot in order to get that RSS feed. To see what I mean, log out of slashdot and then reload the link you provided above - it takes you to an HTML page instead of the RSS feed. You're getting that error because the HTML page isn't valid XML and therefore can't be loaded by XMLDocument.
It seems that you may have to find a way to get your application to authenticate with slashdot before retrieving the feed. I haven't done that before, so I don't have any advice to give for that. :( I'll update this if I find anything.
That is a bit odd. There is a free toolkit for consuming RSS feeds that might make this easier: http://aspnetrsstoolkit.codeplex.com/
Some examples of how to use it:
- http://weblogs.asp.net/scottgu/archive/2006/02/22/Awesome-ASP.NET-2.0-RSS-Tool_2D00_Kit-Released.aspx
- http://aspnetrsstoolkit.codeplex.com/wikipage?title=Consuming%20Feeds&referringTitle=Home
精彩评论