This is the result of my farting around with
XML DOM all day today. It's the first time I've ever gone near anything related to
XML but it works fine, and the output is nice.
Apologies for hogging the random nodes XML all day.
Try it at: http://www.firesmoke.org/randomnodes.asp
<%
' ******************************************
' *
' * ASP E2 random nodes ticker v0.1
' * by Paul McClean
' * http://www.metastreets.com/randomnodes.asp
' * /msg ReiToei for bugs or suggestions
' *
' ******************************************
response.buffer = true
Set XMLdoc = Server.CreateObject( "Microsoft.XMLDOM" )
XMLDoc.async = false
'wait to send to browser until a complete output is created
if xmldoc.load("http://everything2.com/index.pl?node=Random Nodes XML Ticker&lastnode_id=1252991l") then
'wait for XML to load before continuing
'if XML read successful then
XSLString = "randomnodes"
Set oNodeList = xmlDoc.selectNodes(XSLString)
'set up oNodelist to traverse data
for each Item in oNodeList
response.write "<b>" & item.childNodes.item(0).text & "</b>" & "<br>" & vbCr
'write "wit" in bold
for i = 1 to ((item.childNodes.length)-1)
'write node_id's and titles
response.write "<a href=""http://www.everything2.com/?node_id=" & _
item.childNodes.item(i).getAttribute("node_id") & """>" & _
item.childNodes.item(i).text & "</a>" & "<br>" & vbCr
'carraige return to clean up the output
next
response.write "<p>" & vbcrlf
' tidy up output
next
else
'What to say if we couldn't get the XML
response.write "Random nodes XML unavailable! <BR>"
end if
set xmldoc = nothing 'clean up
%>