Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

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:

 

<%@ 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>

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...