RSS Feed

Darkminded

Newcomer
Joined
Aug 28, 2012
Messages
1
Hi everyone,

I am new to ASP.NET and would like some assistance. I'm trying to call an XML tag from a rss feed found online. the tag reads:<dc:subject>5</dc:subject> However, the compiler throws and error when running. Please help.

The code is as follows:

Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="frmListViewExample" runat="server">
    <asp:ListView ID="lvExample" runat="server" DataSourceID="XmlDataSource1">
        <AlternatingItemTemplate>
                Title: <%#XPath("title")%><br />
                Published Date: <%#XPath("pubDate")%><br />
                Link: <%#XPath("link")%><br />
                Description: <%#XPath("description")%>
                 
        </AlternatingItemTemplate>
        <LayoutTemplate>
                <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
        </LayoutTemplate>
        <EmptyDataTemplate>
            No data was returned.
        </EmptyDataTemplate>
        <ItemTemplate>
                Title: <%#XPath("title")%><br />
                Published Date: <%#XPath("pubDate")%><br />
                Link: <%#XPath("link")%><br />
                Description: <%#XPath("description")%><br />
        </ItemTemplate>
        <ItemSeparatorTemplate>
            <hr>
        </ItemSeparatorTemplate>
    </asp:ListView>
    <asp:DataPager ID="DataPager1" runat="server" PagedControlID="lvExample" 
        PageSize="1">
        <Fields>
            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                ShowNextPageButton="False" ShowPreviousPageButton="False" />
            <asp:NumericPagerField />
            <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                ShowNextPageButton="False" ShowPreviousPageButton="False" />
        </Fields>
    </asp:DataPager>
    <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://earthquake.usgs.gov/earthquakes/shakemap/rss.xml"
            XPath="rss/channel/item"></asp:XmlDataSource>
    </form>
</body>
</html>
 
Last edited by a moderator:
Back
Top