RSS è un particolare formato, inventato e messo punto da Netscape, per scambiare dati attraverso un file XML.
E' utilizzato dalla maggior parte dei siti, essendo in pratica uno standard per la creazione di feed.
Lo script di oggi si occupa proprio di mostrarne, dato un feed, i contenuti, utilizzando il parser XML di Microsoft per "navigare" tra i contenuti del file XML generato.
<%
Sub RSS (URL)
Set objXML = Server.CreateObject("msxml2.DOMDocument.3.0")
objXML.async = false
objXML.setProperty "ServerHTTPRequest", True
' validazione
objXML.validateOnParse =false' true
' non conservare spazi
objXML.preserveWhiteSpace = false
blnLoaded = objXML.Load(URL)
If Not blnLoaded Then
Response.write "<P>ERRORE<br>codice: " & _
objXML.parseError.errorCode & _
"<br>Linea/Col: " & _
objXML.parseError.line & "/" & _
objXML.parseError.linepos & "</P>"
Else
Set objNodeList = objXML.getElementsByTagName("item")
For Each objNode In objNodeList
For Each objNode2 In objNode.childNodes
Select Case objNode2.nodeName
Case "title"
strTitle = objNode2.firstChild.nodevalue
Case "link"
strURL = objNode2.firstChild.nodevalue
Case "description"
strDescription = objNode2.firstChild.nodevalue
End Select
Next
' mostro a video
Response.write "<li><a href=""" & strURL & """>" & _
strTitle & "</A><BR>" & strDescription
strTitle = ""
strURL = ""
strDescription = ""
Next
set objNodeList = Nothing
End if
End sub
' RSS di ASPItalia.com
call RSS("http://newsgroup.aspitalia.com/feed/feed.xml")
%>Il feed utilizzato in questo esempio è quello relativo agli ultimi 6 contenuti pubblicati su ASPItalia.com
Ci sono comunque molti altri siti che offrono questo servizio, tra cui, ad esempio, moreover.com.




Commenti
Accedi per commentare
Per partecipare alla conversazione, accedi o crea un account gratuito.