Hi,
I'm currently trying to display a XML file within a ASP page, although
get the following error when trying to select one of the notes... the
node is called: <content:encoded>
This is the error
Reference to undeclared namespace prefix: 'content'.
This is my code
<%@ Language="VBScript" %>
<html lang="en">
<head>
<title>Some feeds</title>
<script runat="server" language="VBScript">
Sub OutputFeed (feedURL)
Dim XmlDocument
Set XmlDocument = Server.CreateObject("Msxml2.DOMDocument.4.0")
XmlDocument.setProperty "ServerHTTPRequest", true
XmlDocument.async = False
Dim Loaded
Loaded = XmlDocument.load(feedURL)
If Loaded Then
Dim Items, Item, Title, Link, Description, TitleText,
DescriptionText, LinkURL, Content2, Contenttext
Set Items = XmlDocument.selectNodes("//item")
Response.Write "<p>Feed from " & feedURL & " has currently " &
Items.Length & " items.</p>" & VbCrLf
Response.Write "<ul>" & VbCrLf
For Each Item in Items
Set Title = Item.selectSingleNode("title/text()")
If Title Is Nothing Then
TitleText = ""
Else
TitleText = Title.data
End If
Set Link = Item.selectSingleNode("link/text()")
If Link Is Nothing Then
LinkURL = ""
Else
LinkURL = Trim(Link.data)
End If
Set Content2 = Item.selectSingleNode("content:encoded")
If Content2 Is Nothing Then
Contenttext = ""
Else
Contenttext= Trim(Content2.data)
End If
Set Description = Item.selectSingleNode("description/text()")
If Description Is Nothing Then
DescriptionText = ""
Else
DescriptionText = Description.data
End If
Response.Write "<li><a href=""" & LinkURL & """>" & TitleText &
": " & DescriptionText & "</a></li>" & VbCrLf
response.Write contexttext
Next
Response.Write "</ul>" & VbCrLf
End If
End Sub
</script>
</head>
<body>
<h1>Some feeds</h1>
<%
OutputFeed("http://www.biblegateway.com/usage/votd/rss/votd.rdf?31")
OutputFeed("http://rss.news.yahoo.com/rss/elections")
OutputFeed("http://www.cbsnews.com/feeds/rss/main.rss")
OutputFeed("http://rss.cnn.com/rss/si_topstories.rss")
%>
</body>
</html>
Thank you for your help