ho visto il file http://freeasp.html.it/articoli/vie...colo.asp?id=172
e così ho fatto il mio file che pesca dal mio db modificando questo file presente nell'esempio (il cui indirizzo ho riportato opra):
__________
<%
'Stringa di connessione al nostro Data Base di news
'Modificatela in base al percorso del vostro Data Base
StrConnessione = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/rss/ASP") & "\News.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open StrConnessione
'Istruzione SQL che prende le news dal Data Base; modificate il nome della vostra tabella e i vari nomi dei campi
SQL ="SELECT * FROM news Order by idnews desc"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.CursorLocation=3
rs.Open SQL, Conn, 1,1
' Numero totale di records
totfiles = rs.recordcount
xml = "<?xml version=""1.0"" encoding=""UTF-8""?><rss version=""0.91""><channel><title>Le Ultime
Notizie</title><description>Notizie dal mondo in tempo
reale</description><link>http://www.tgcom.it</link><language>it</language>"
'Se il Record Set non è vuoto
if totfiles <>0 then
Do while not rs.eof
xml = xml & "<item>"
xml = xml & "<title><![CDATA[" & rs("titolo") & "]]></title>"
xml = xml & "<description><![CDATA[" & rs("descrizione") & "]]></description>"
xml = xml & "<link><![CDATA[http://www.tuosito.com/legginews.asp?id=" & rs("idnews") & "]]></link></item>"
rs.movenext
Loop
End if
xml = xml & "</channel></rss>"
' Impostazione che setta il tipo di file in output su XML
response.ContentType = "text/xml"
response.write xml
'Libero Risorse
rs.close
set rs=nothing
Conn.Close
set Conn=nothing
%>
e mi dà questo risultato ovviamente con i dati che va a pescare dal mio db:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="0.91">
<channel>
<title>Titolo del vostro RSS </title>
<description>Descrizione del vostro RSS</description>
<link>URL del vostro RSS</link>
<item>
<title><![CDATA[ Titolo notizia 1 ]]></title>
<description><![CDATA[ Descrizione o Corpo notizia 1]]></description>
<link><![CDATA[ URL per leggere la notizia 1 sul web]]></link>
</item>
<item>
<title><![CDATA[ Titolo N ]]></title>
<description><![CDATA[ Descrizione o Corpo notizia N]]></description>
<link><![CDATA[ URL per leggere la notizia N sul web]]></link>
</item>
</channel>
</rss>
___
ora il punto è questo... il codice che riporto sotto dovrebbe servire per visualizzare su un altro sito i dati del mio db giusto? e allora cosa devo modificare affinché funzioni e soprattutto come posso fare affinché il risultato sia simile a quello che si può vedere su http://www.steweb.net dove vengono riprese le notizie del sito di aspitalia?!!?
____
<%
' Script ASP che rielabora un documento XML RSS e RDF e fornisce in output un documento HTML
url=request("url")
' Creo oggetto DOM XML
Set objXML = Server.CreateObject("msxml2.DOMDocument.3.0")
objXML.async = false
objXML.setProperty "ServerHTTPRequest", True
' validazione del documento XML
objXML.validateOnParse =false' true
' non conservare spazi
objXML.preserveWhiteSpace = false
blnLoaded = objXML.Load(url)
If Not blnLoaded Then
Response.write "Nessuna news da visualizzare"
Else
set objNodeList = objXML.getElementsByTagName("channel")
For Each objNode In objNodeList
For Each objNode2 In objNode.childNodes
Select Case objNode2.nodeName
Case "title"
html = html + "<tr><td>"
html = html + objNode2.firstChild.nodevalue
html = html + "</td></tr>"
Case "link"
html = html + "<tr><td><a target=_blank href=" + objNode2.firstChild.nodevalue + ">"
html = html + objNode2.firstChild.nodevalue
html = html + "</a></td></tr>"
Case "description"
html = html + "<tr><td>"
html = html + objNode2.firstChild.nodevalue
html = html + "</td></tr>"
End Select
Next
Next
html = html + "<tr><td><hr></td></tr>"
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
html = html + "<tr><td><li/>" + strTitle + "
" + strDescription
+"</td></tr>"
strTitle = ""
strURL = ""
strDescription = ""
Next
html = "<table width=400>"+html+"</table>"
set objNodeList = Nothing
End if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<%
Response.write (html)
%>
<table border="0" width="400" cellspacing="0" cellpadding="0">
<form action="RSSview.asp" method="POST">
<tr>
<td width="100%"><hr></td>
</tr>
<tr>
<td width="100%">Inserire l'URL di un feed RSS o RDF</td>
</tr>
<tr>
<td width="100%"><input type="text" size="60" name="url" >
</td>
</tr>
<tr>
<td width="100%"><input type="submit" value="Visualizza">
</td>
</tr>
</form>
</table>
</body>
</html>

Rispondi quotando