Imports:
Imports System.Xml
Imports System.Data
Example Function:
Private Function ExtractGoogleNewsRSS(ByVal strSearchString As String) As Generic.List(Of NewsItem)
Dim NewsItems As New List(Of NewsItem)
Dim strSearchURL As String = String.Concat("http://news.google.com/news?hl=en&ned=us&q=", strSearchString, "&ie=UTF-8&output=rss")
Using reader As XmlTextReader = New XmlTextReader(strSearchURL), _
ds As New DataSet
Dim dt As DataTable
ds.ReadXml(reader)
dt = ds.Tables(3)
For Each row As DataRow In dt.Rows
Dim itm As New NewsItem
itm.Title = row("title")
itm.PublishDate = row("pubdate")
itm.Description = row("description")
itm.URLString = row("link")
NewsItems.Add(itm)
Next
End Using
Return NewsItems
End Function
Private Class NewsItem
Private _title As String
Private _publishDate As Date
Private _description As String
Private _uRLString As String
Public Property Title() As String
Get
Return _title
End Get
Set(ByVal value As String)
_title = value
End Set
End Property
Public Property PublishDate() As Date
Get
Return _publishDate
End Get
Set(ByVal value As Date)
_publishDate = value
End Set
End Property
Public Property Description() As String
Get
Return _description
End Get
Set(ByVal value As String)
_description = value
End Set
End Property
Public Property URLString() As String
Get
Return _uRLString
End Get
Set(ByVal value As String)
_uRLString = value
End Set
End Property
End Class
You can easily load the Google News RSS data into an "XmlTextReader". The "ReadXml" method of the "DataSet" converts the xml data into a "DataSet". The "NewsItem" class is just an example data container.