Here is my working code to pull Yahoo business news RSS feed. Can
anyone show me how to only return the top 3 or 4 news articles?
<%@ Import Namespace="Syst em.Xml" %>
<script language="VB" runat="server">
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s)
If Cache("RSS1") Is Nothing then
Dim dt as DataTable =
GetRSSFeed("htt p://rss.news.yahoo. com/rss/business")
Cache.Insert("R SS1", dt, Nothing, DateTime.Now.Ad dMinutes(180),
TimeSpan.Zero)
End If
rss.DataSource = Cache("RSS1")
rss.DataBind()
End Sub
Function GetRSSFeed(strU RL as String) as DataTable
Dim reader as XmlTextReader = New XmlTextReader(s trURL)
Dim ds as DataSet = New DataSet()
ds.ReadXml(read er)
Return ds.Tables(3)
End Function
</script>
<asp:DataList runat="server" id="rss">
<itemtemplate >
<font size="2" face="Geneva, Arial, Helvetica, san-serif"><b><a
href="<%# DataBinder.Eval (Container.Data Item, "link") %>"
target="_blank" ><%# DataBinder.Eval (Container.Data Item, "title")
%></a></b><br />
<%# DataBinder.Eval (Container.Data Item, "descriptio n")
%></font><br />
</itemtemplate>
</asp:DataList>
Thanks in advance,
Jeremy Reid
http://hgtit.com