rss feed中的意外标记

时间:2009-12-23 18:46:22

标签: xml rss token feed

我正在尝试处理rss网址,但是却给了我一个错误 “' - '是一个意外的令牌。预期的令牌是'>'。第81行,第5位。”

当我查看源代码时,它在xml节点的中间有一个值“Knowledge @ Wharton - Innovation and Entrepreneurship”。

如何处理此网址并忽略该错误。

Public Shared Function HasRssItems() As Boolean
    Dim myRequest As WebRequest
    Dim myResponse As WebResponse
    Try
        myRequest = System.Net.WebRequest.Create("http://www.google.com/reader/shared/i.am.muralibala")
        myRequest.Timeout = 5000
        myResponse = myRequest.GetResponse()

        Dim rssStream As Stream = myResponse.GetResponseStream()
        Dim rssDoc As New XmlDocument()
        rssDoc.Load(rssStream)

        Return rssDoc.SelectNodes("rss/channel/item").Count > 0
    Catch ex As Exception
        Return False
    Finally
        myResponse.Close()
    End Try

End Function

1 个答案:

答案 0 :(得分:0)