六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

讀取符合RSS2.0規范的XML文檔

[摘要]想試著做一個簡單的讀取RSS新聞的頁面 雖然將.net中關于XML的幾個類看了個遍但還是不太懂這是我寫的一個讀取XML文檔的函數直接在設計頁面中調用就行 Public Function LoadRSS(ByVal RssUrl As String, ByVal showNewsCount As I...
想試著做一個簡單的讀取RSS新聞的頁面

雖然將.net中關于XML的幾個類看了個遍

但還是不太懂

這是我寫的一個讀取XML文檔的函數

直接在設計頁面中調用就行

 

Public Function LoadRSS(ByVal RssUrl As String, ByVal showNewsCount As Integer) As String

        Try

            '讀取xml文檔
            Dim objXMLDoc As New System.Xml.XmlDocument()
            Dim strNodes As String = ""
            Dim objItems As System.Xml.XmlNodeList
            Dim objItems1 As System.Xml.XmlNodeList
            Dim objNode As System.Xml.XmlNode
            Dim objNode1 As System.Xml.XmlNode
            Dim i As Integer
            Dim newsTitle As String
            Dim newsUrl As String
            Dim newsDescription As String
            Dim newsPubDate As String
            Dim newsAuthor As String
            Dim newsCategory As String

            objXMLDoc.Load(RssUrl)

            objItems = objXMLDoc.GetElementsByTagName("item")

            If RssUrl = "" Then
                RSSNews = "未找到信息源,您可刷新重試或聯系管理員!"
                Exit Function
            End If

            If CStr(showNewsCount) = "" Or showNewsCount > 30 Then
                showNewsCount = 10        '默認新聞顯示數目
            End If

            If showNewsCount = 0 Then
                showNewsCount = objItems.Count
            End If

            If objXMLDoc.HasChildNodes = True Then
                i = 1
                For Each objNode In objItems

                    If objNode.HasChildNodes = True Then
                        objItems1 = objNode.ChildNodes
                        For Each objNode1 In objItems1

                            Select Case objNode1.Name
                                Case "title"
                                    newsTitle = objNode1.InnerText
                                Case "link"
                                    newsUrl = objNode1.InnerText
                                Case "description"
                                    newsDescription = objNode1.InnerText
                                    If Len(newsDescription) > 500 Then
                                        newsDescription = Left(newsDescription, 200)
                                    End If
                                    newsDescription = FilterHtml(newsDescription)
                               Case "category"
                                    newsCategory = objNode1.InnerText
                                Case "author"
                                    newsAuthor = objNode1.InnerText
                                Case "pubDate"
                                    newsPubDate = objNode1.InnerText
                            End Select


                        Next
                        strNodes += "<a href=viewnews.aspx?newstitle=" & Server.UrlEncode(newsTitle) & "&newsurl=" & Server.UrlEncode(newsUrl) & _
                                    "&newsdscrp=" & Server.UrlEncode(newsDescription) & "&newscat=" & Server.UrlEncode(newsCategory) & _
                                    "&newsauthor=" & Server.UrlEncode(newsAuthor) & "&newsdate=" & Server.UrlEncode(newsPubDate) & _
                                    " target=_blank>" & newsTitle & "</a><br>"
                    End If
                    i = i + 1
                    If i > showNewsCount Then Exit For
                Next
            End If

            LoadRSS = strNodes

        Catch objErr As Exception
            LoadRSS = "RSS Feed 源數據出錯!"

        End Try

    End Function





主站蜘蛛池模板: 色站app | 亚洲一区视频 | 天天碰夜夜操 | 在线免费黄| 亚洲成a人v天堂网 | 青青草久草 | 日韩 亚洲 中文 图片 小说 | 五月婷婷丁香在线 | 亚洲综合成人网 | 色视频网站色视频播放 | 日产精品久久久一区二区 | 性欧美日本 | 亚洲精品福利你懂 | 午夜网站在线观看免费网址免费 | 色婷婷在线视频 | 在线久综合色手机在线播放 | 亚洲欧美日韩中文不卡 | 自偷自拍视频 | 午夜性刺激在线观看视频 | 亚洲小视频在线播放 | 色偷偷91综合久久噜噜app | 亚洲在成人网在线看 | 在线观看一区 | 人妖欧美一区二区三区四区 | 天天碰夜夜操 | 午夜久久精品 | 在线免费观看h | 在线欧美自拍 | 天天做人人爱夜夜爽2020 | 亚洲成av人片在线观看天堂无码 | 亚洲国产天堂久久综合图区 | 日韩视频在线观看中字 | 啪啪免费网站 | 青草久久久 | 日本男人的天堂 | 中文字幕不卡免费高清视频 | 日韩理论片西瓜影音 | 亚洲精品高清在线观看 | 日韩毛片免费观看 | 天天天天添天天拍天天谢 | 日日夜夜国产 |