new ASP and XML tricks

I’m pretty stoked. Today we got to work with an XML feed and pass it into ASP… pretty cool stuff.

Check the code:

<%
DIM objXMLHTTP, xmlUrl, xmlDoc
xmlUrl="http://www.spiderline.com/exec/search?&b=AND&a=13218&f=xml&q=& 
& Request.QueryString("q")
SET objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") 
objXMLHTTP.Open "GET", xmlUrl, false 
objXMLHTTP.SetRequestHeader "Content-type", "text/html" 
objXMLHTTP.Send 
SET xmlDoc = Server.CreateObject("Microsoft.XMLDOM") 
xmlDoc.async="false" 
xmlDoc.loadXML(objXMLHTTP.responseText) 
DIM xmlLst, xmlItm
SET xmlLst=Server.CreateObject("Microsoft.XMLDOM")
SET xmlItm=Server.CreateObject("Microsoft.XMLDOM")
SET xmlLst=xmlDoc.getElementsByTagName("Record")
FOR i = 0 To (xmlLst.length -1) 
set xmlItm = xmlLst.item(i)

url=xmlItm.getAttribute("url")
title=xmlItm.getAttribute("title")
match=xmlItm.getAttribute("match")
desc=xmlItm.getAttribute("description")

modDate=xmlItm.getAttribute("modified")
rating=xmlItm.getAttribute("rating")
max_rating=xmlItm.getAttribute("max_rating")
ratingPercent=(Cint(rating)/Cint(max_rating))*100

'//write out HTML here...
NEXT
%>

Jul 23, 2002

6:45 pm

This entry has been tagged with:

ASPTechnologyXML