ASP.NET RSS Toolkit(RSS工具)

作者:互联网

2009-06-30

ASP.NET教程

还记得以前吗?以前要做页面上写个小组件,调用指定(RSS输出地址的)的内容。最好的办法就是通过XSLT+XML来输出字符 串。让我们还是花了一分钟的时候回忆一下以前的做法吧

曾经的做法:

 Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
            Dim CacheKey As String = Url & "-" & Sort
            Dim objCache As System.Web.Caching.Cache = HttpRuntime.Cache
            If objCache.Item(CacheKey) Is Nothing Then
                Dim xpDocument As XPathDocument = New XPathDocument(Url, XmlSpace.Preserve)
                Dim XTran As XslTransform = New XslTransform
                XTran.Load(Web.HttpRuntime.AppDomainAppPath & "TransForm.xsl") 'TransForm.xsl
                Dim sw As StringWriter = New StringWriter

                Dim xArgList As XsltArgumentList = New XsltArgumentList
                xArgList.AddParam("Sort", "", Sort)
                xArgList.AddParam("strlength", "", strLength)
                XTran.Transform(xpDocument, xArgList, sw)
                objCache.Insert(CacheKey, sw, Nothing, DateTime.Now.AddMinutes(15), TimeSpan.Zero)
            End If
            MyBase.Text = CType(objCache.Item(CacheKey), StringWriter).ToString

        End SubXSLT转换文件


    version="1.0"
    xmlns:xsl=""
    xmlns=""
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:dc=""
    xmlns:slash=""
    xmlns:sy=""
    xmlns:resuls="urn:StrLength">



   


    Function GetSubString(byval origStr As String, byval endIndex As Integer) As String
   Dim bytes As Byte() = System.Text.Encoding.GetEncoding("gb2312").GetBytes(origStr)
   If endIndex >= bytes.Length Then
      Return origStr
   End If
   Dim subBytes(endIndex) As Byte
   Array.Copy(bytes, 0, subBytes, 0, endIndex)
   Return System.Text.Encoding.GetEncoding("gb2312").GetString(subBytes) + ""
End Function 'GetSubString

    public function strDate(byval s as string)as string
        return CDate(s).Day.ToString & "日"
    end function
]]>


   


       
           
           

               


 

根据RSS输出的格式,进行绑定


OK。现在可以浏览一下效果


晚上出去吃晚饭的时候。走出外面,感觉到夏天的来到。呵。我喜欢夏天的这种感觉。带上好的心情,出去走走。也是一种很好的享受。最后。推荐一首歌:夏天的味道。

相关标签:

ASP.NET
脚本在线

智能赋能梦想,脚本构筑现实。我们致力于链接AI智能指令 与传统自动化,为您提供一站式、高效率的脚 本资产与生成 服务。

核心板块

AI脚本库 自动化仓库 脚本实验室

关于我们

最新游戏 商务合作 隐私政策

社区支持

API文档 攻略资讯 违规举报

© 2026 jiaoben.net | 脚本在线 | 联系:jiaobennet2026@163.com

备案:湘ICP备18025217号-11