JacobHansen
November 21st, 2003, 01:29 AM
I have created an asp news grabber by using Msxml2.ServerXMLHTTP.4.0
The code works fine when I grab headers from RSS 0.91 +
But when I add URL from RDF sites the code reports an error
Microsoft VBScript runtime error '800a01a8'
Object required: '[object]'
/grab.asp, line 68
The line 68 have look like this:
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
Is there anyone that can see what's wrong in the code bellow? What shall I do to get this code also to work with RDF feeds?
Regards
Jacob
<h3>BBC Top News</h3>
<%
Dim srvXmlHttp
Dim URL
Dim newsElement
Dim objNodeList1
Dim objNodeList2
Dim i
set srvXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
URL =
"http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/world/rss091.xml"
srvXmlHttp.open "GET", URL, false
srvXmlHttp.send
newsElement = srvXmlHttp.responsexml.text
if (Cint(srvXmlHttp.status) = 200) then
set objNodeList1 =
srvXmlHttp.responseXML.getElementsByTagName("title")
set objNodeList2 =
srvXmlHttp.responseXML.getElementsByTagName("link")
response.write "<ul>"
response.write "<li>" & vblf
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
response.write (objNodeList1.Item(2).text)
response.write "</a>"& vblf
response.write "</li>"& vblf
response.write "</ul>"
end if
%>
<h3>Yahoo Top News</h3>
<%
URL = "http://rss.news.yahoo.com/rss/topstories"
srvXmlHttp.open "GET", URL, false
srvXmlHttp.send
newsElement = srvXmlHttp.responsexml.xml
if (Cint(srvXmlHttp.status) = 200) then
set objNodeList1 =
srvXmlHttp.responseXML.getElementsByTagName("title")
set objNodeList2 =
srvXmlHttp.responseXML.getElementsByTagName("link")
response.write "<ul>"
response.write "<li>" & vblf
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
response.write (objNodeList1.Item(2).text)
response.write "</a>"& vblf
response.write "</li>"& vblf
response.write "</ul>"
end if
%>
<h3>Freshmeat</h3>
<%
' This URL give an error
URL = "http://freshmeat.net/backend/fm.rdf"
srvXmlHttp.open "GET", URL, false
srvXmlHttp.send
newsElement = srvXmlHttp.responsexml.xml
if (Cint(srvXmlHttp.status) = 200) then
set objNodeList1 =
srvXmlHttp.responseXML.getElementsByTagName("title")
set objNodeList2 =
srvXmlHttp.responseXML.getElementsByTagName("link")
'Open this to check the requset
'response.write srvXmlHttp.status
'response.write srvXmlHttp.responsexml.xml
response.write "<ul>"
response.write "<li>" & vblf
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
response.write (objNodeList1.Item(2).text)
response.write "</a>"& vblf
response.write "</li>"& vblf
response.write "</ul>"
end if
%>
The code works fine when I grab headers from RSS 0.91 +
But when I add URL from RDF sites the code reports an error
Microsoft VBScript runtime error '800a01a8'
Object required: '[object]'
/grab.asp, line 68
The line 68 have look like this:
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
Is there anyone that can see what's wrong in the code bellow? What shall I do to get this code also to work with RDF feeds?
Regards
Jacob
<h3>BBC Top News</h3>
<%
Dim srvXmlHttp
Dim URL
Dim newsElement
Dim objNodeList1
Dim objNodeList2
Dim i
set srvXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
URL =
"http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/world/rss091.xml"
srvXmlHttp.open "GET", URL, false
srvXmlHttp.send
newsElement = srvXmlHttp.responsexml.text
if (Cint(srvXmlHttp.status) = 200) then
set objNodeList1 =
srvXmlHttp.responseXML.getElementsByTagName("title")
set objNodeList2 =
srvXmlHttp.responseXML.getElementsByTagName("link")
response.write "<ul>"
response.write "<li>" & vblf
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
response.write (objNodeList1.Item(2).text)
response.write "</a>"& vblf
response.write "</li>"& vblf
response.write "</ul>"
end if
%>
<h3>Yahoo Top News</h3>
<%
URL = "http://rss.news.yahoo.com/rss/topstories"
srvXmlHttp.open "GET", URL, false
srvXmlHttp.send
newsElement = srvXmlHttp.responsexml.xml
if (Cint(srvXmlHttp.status) = 200) then
set objNodeList1 =
srvXmlHttp.responseXML.getElementsByTagName("title")
set objNodeList2 =
srvXmlHttp.responseXML.getElementsByTagName("link")
response.write "<ul>"
response.write "<li>" & vblf
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
response.write (objNodeList1.Item(2).text)
response.write "</a>"& vblf
response.write "</li>"& vblf
response.write "</ul>"
end if
%>
<h3>Freshmeat</h3>
<%
' This URL give an error
URL = "http://freshmeat.net/backend/fm.rdf"
srvXmlHttp.open "GET", URL, false
srvXmlHttp.send
newsElement = srvXmlHttp.responsexml.xml
if (Cint(srvXmlHttp.status) = 200) then
set objNodeList1 =
srvXmlHttp.responseXML.getElementsByTagName("title")
set objNodeList2 =
srvXmlHttp.responseXML.getElementsByTagName("link")
'Open this to check the requset
'response.write srvXmlHttp.status
'response.write srvXmlHttp.responsexml.xml
response.write "<ul>"
response.write "<li>" & vblf
response.write "<a href='" & objNodeList2.Item(2).text & "'>"
response.write (objNodeList1.Item(2).text)
response.write "</a>"& vblf
response.write "</li>"& vblf
response.write "</ul>"
end if
%>