View Full Version : xml .net newbie

07-08-2009, 10:24 PM
Had a repeater giving out an rss xml data feed, but it took too long to load, so I'm using an ajax incremental page loader and need to get the xml into an innerhtml format so I can write it back to the page's div tag via a web service. I've tried researching for days, but I'm having trouble getting the description piece (the title and link come through fine) and wondered if anyone would be willing to explain it and help out?

<asp:Repeater ID="rptr" runat="server" DataSourceID="XmlDataSource">
<<%# XPath("title") %><br />
<%# XPath("description") %><a href='<%# XPath("link") %>'>...details</a><br /><br />
<asp:XmlDataSource ID="XmlDataSource" runat="server" DataFile="http://www.exploreasheville.com/rss-feeds/asheville-happenings/index.aspx" XPath="rss/channel/item" >

The following works with only (0) and (1), until I try to pull back the description (I'm guessing (2) because of xml page structure below), then I only get [object Object] .

Dim myStr As String
Dim m_xmld As System.Xml.XmlDocument
Dim m_nodelist As System.Xml.XmlNodeList
Dim m_node As System.Xml.XmlNode
m_xmld = New System.Xml.XmlDocument()
m_nodelist = m_xmld.SelectNodes("rss/channel/item")
'Loop through the nodes
For Each m_node In m_nodelist
'Get the Element Values
Dim titleValue = m_node.ChildNodes.Item(0).InnerText
Dim linkValue = m_node.ChildNodes.Item(1).InnerText
myStr &= titleValue & "<br />" & "description to follow&nbsp;<a href='" & _
linkValue & "'>...details</a><br />"
Catch errorVariable As Exception
'Error trapping
myStr &= errorVariable.ToString()
End Try
Return myStr

When I view the source of the page, this is the structure:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:rei="http://r-effects.com">
<title>Asheville Happenings</title>
<description>Featured upcoming happenings in Asheville, North Carolina.</description>
<copyright>Buncombe County Tourism Development Authority</copyright>
<image><title /><URL /><link /></image>

<title>Apr 25, 2009 - Sep 20, 2009: The Legacy Continues</title>