Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(url)
Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()
Dim rssStream As System.IO.Stream = myResponse.GetResponseStream()
Dim rssDoc As New System.Xml.XmlDocument()
Try
rssDoc.Load(rssStream)
Catch nosupport As NotSupportedException
Throw nosupport
End Try
Dim rssItems As System.Xml.XmlNodeList = rssDoc.SelectNodes("rss/channel")
'For i As Integer = 0 To rssItems.Count - 开发者_如何学JAVA1
Dim rssDetail As System.Xml.XmlNode
rssDetail = rssItems.Item(0).SelectSingleNode("lastBuildDate")
Folks this is what I'm using to parse an RSS feed for the last updated time. Is there a quicker way? Speed seems to be a bit slow on it as it pulls down the entire feed before parsing.
Use the XMLReader class to read the data as it comes in. As soon as you find what you are looking for you can kill the stream.
精彩评论