gpt4 book ai didi

c# - RSS 提要 XMLDataSource 过滤器 RSS 项目

转载 作者:太空宇宙 更新时间:2023-11-03 16:49:21 26 4
gpt4 key购买 nike

如果在 XMLDataSource 中使用标准 RSS 提要,过滤 RSS 提要以仅显示 RSS 提要项目描述包含特定术语的项目的最佳方法是什么?

例如,我希望过滤以下 RSS 提要,其中描述包含特定球队名称,例如“利物浦”

http://pipes.yahoo.com/pipes/pipe.run?_id=9dae054b43e8ded5a10a659c39c72f49&_render=rss

我设置 XML 数据源的代码如下:

 HomeDataSource.DataFile = "http://pipes.yahoo.com/pipes/pipe.run?_id=9dae054b43e8ded5a10a659c39c72f49&_render=rss";
HomeDataSource.XPath = "rss/channel/item";
HomeListView.DataSourceID = "HomeDataSource";
HomeListView.DataBind();

使用以下源代码显示上述代码的输出:

 <asp:ListView ID="HomeListView" runat="server">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<li><a target="_blank" href="<%#XPath("link")%>">
<%#XPath("title")%></a>
</li>
</ItemTemplate>
</asp:ListView>

非常感谢您提供的任何建议。

最佳答案

您将面临的问题是不同的提要类型,Atom、RSS 1.0/2.0 等,对某些公共(public)字段使用不同的名称。您可以创建自定义 DataSource 控件以公开 System.ServiceModel.Syndication SyndicationFeed 对象以进行绑定(bind)或读取后面代码中的提要并将 SyndicationFeed 或 SyndicationFeed.Items 绑定(bind)为 ListViews 数据源。

关于c# - RSS 提要 XMLDataSource 过滤器 RSS 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4640443/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com