做一个新闻系统,想加上RSS功能,不知道怎么写程序啊?有这样的代码吗??

解决方案 »

  1.   

    研究一下RSS的标准就可以了
    说白了就是一个固定了格式的XML文件而已
      

  2.   

    Public Function getrss(ByVal strsql As String) As String 'getRSS
            Dim strRSS As String
            Dim i As Int64
            Dim K As Int64
            OleDbConnection1.ConnectionString = strconnection
            OleDbDataAdapter1.SelectCommand.Connection = OleDbConnection1
            OleDbDataAdapter1.SelectCommand.CommandText = strsql
            OleDbConnection1.Open()        OleDbDataAdapter1.Fill(DataSet1)
            'DataSet1.Reset() ' 清除所有的记录集
            'datagrid1.DataSource = DataSet1.Tables.Item(dt)
            'datagrid1.DataBind()
            strRSS = strRSS + "<?xml version=""1.0"" encoding=""gb2312""?>"
            strRSS = strRSS + "<rss version=""2.0""> "
            strRSS = strRSS + "<channel>"
            strRSS = strRSS + "<title>*********</title>"
            strRSS = strRSS + "<link>http://www.******/unet</link>"
            strRSS = strRSS + "<language>zh-cn</language> "
            strRSS = strRSS + "<description>BY UNET</description>"
            Dim R As DataRow
            For Each R In DataSet1.Tables(0).Rows
                strRSS = strRSS & "<item>"
                strRSS = strRSS & "<title>" & R(3) & "</title>"
                strRSS = strRSS & "<link>http://www.****/shownews.aspx?id=" & R(0) & "</link> "
                'strRSS = strRSS & "<description>" & R(0) & "</description>"
                strRSS = strRSS & "<copyright>BY UNET</copyright>"
                strRSS = strRSS & "<pubDate>" & R(8) & "</pubDate>"
                'strRSS = strRSS & "<comments>" & R(0) & "</comments>"
                strRSS = strRSS & "</item>"        Next        strRSS = strRSS + "</channel>"
            strRSS = strRSS + "</rss>"
            Return strRSS        OleDbConnection1.Close()    End Function
      

  3.   

    RSS(Really Simple Syndication)是一种描述和同步网站内容的格式,是目前使用最广泛的XML应用。 具体的Google一下,资料很多
      

  4.   


    这个可能对你有帮助http://www.51aspx.com/CV/RssReader