C# 我需要一些从Wordpress导入RSS提要的帮助
我正在尝试从Wordpress RSS源导入最后5篇文章,并在我的网站上显示它们 我用的是这个,但它抓住了整个饲料C# 我需要一些从Wordpress导入RSS提要的帮助,c#,asp.net,C#,Asp.net,我正在尝试从Wordpress RSS源导入最后5篇文章,并在我的网站上显示它们 我用的是这个,但它抓住了整个饲料 <asp:DataList ID="dataNews" runat="server" DataSourceID="xmlSource" > <ItemTemplate> <a href="<%# XPath("link") %>"><%# XPath("title") %></
<asp:DataList ID="dataNews" runat="server" DataSourceID="xmlSource" >
<ItemTemplate>
<a href="<%# XPath("link") %>"><%# XPath("title") %></a>
</ItemTemplate>
</asp:DataList>
<asp:XmlDataSource ID="xmlSource" runat="server" DataFile="http://myblog.com/feed" XPath="rss/channel/item" EnableCaching="true" />
如何实现这一点?您可以使用XPath表达式来帮助您实现这一点,如本文所述:。以下几点应该行得通
<asp:XmlDataSource ID="xmlSource" runat="server" DataFile="http://myblog.com/feed" XPath="rss/channel/item[position()<6]" EnableCaching="true" />
这很有效。所以谢谢你!但如果我的博客订阅被关闭,它将错误地出现在我的整个头版。我应该把这些都写在代码中,还是有一些选项可以使用我的代码?