<%
function getNews(strurl)
set ObjSXH = createobject("Msxml2.ServerXMLHTTP.3.0")
set objXML = createobject("Msxml2.DOMDocument")
url = strurl
ObjSXH.open "GET", url, False
'Send the request
ObjSXH.send ""
'If the request succeeded
if ObjSXH.status = 200 then
'returned XML as a DOMDocument
set ObjXML = ObjSXH.responseXML
'retrieve products from xml document
on error resume next
set entryNodeList = objXML.getElementsByTagName("entry")
listLength = entryNodeList.length
for j = 0 to listLength - 1
If listLength > 0 Then
entryCount = entryCount + 1
End If
set entryNode = entryNodeList.Item(j)
'reinitialize variables
title = ""
link = ""
id = ""
published = ""
updated = ""
summary = ""
for each entryAttribute in entryNode.childNodes
nodeName = UCASE(entryAttribute.nodeName)
set entryNode = entryNodeList.Item(j)
If nodeName = "TITLE" Then
title = Replace(entryAttribute.Text, "'", "''")
ElseIf nodeName = "LINK" Then
link = Replace(entryAttribute.Text, "'", "''")
ElseIf nodeName = "ID" Then
id = Replace(entryAttribute.Text, "'", "''")
ElseIf nodeName = "PUBLISHED" Then
published = Replace(entryAttribute.Text, "'", "''")
ElseIf nodeName = "UPDATED" Then
updated = Replace(entryAttribute.Text, "'", "''")
ElseIf nodeName = "SUMMARY" Then
summary = Replace(entryAttribute.Text, "'", "''")
End If
Next
if entryName = "" then entryName = left(description,400)
'-- insert into database
Next
end if
getNews = title&"|"&link&"|"&id&"|"&published&"|"&updated&"|"&summary
end function
Response.write getNews("http://blog.mlive.com/saginawnews_impact/atom.xml")
%>
|