Author |
Topic |
vesse
New Member
United Kingdom
69 Posts |
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 11 February 2004 : 04:57:08
|
Richard Kinser has already done this - a search for RSS here should find a few interesting topics, and the code you require. |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
|
Jeepaholic
Average Member
USA
697 Posts |
|
Astralis
Senior Member
USA
1218 Posts |
Posted - 11 February 2004 : 15:38:25
|
On a website or desktop? |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 11 February 2004 : 16:00:20
|
Jeep, Trillian has an RSS plugin, and I used something off SourceForge for a while but the name escapes me now Their icon was a cube. |
|
|
Jeepaholic
Average Member
USA
697 Posts |
|
Astralis
Senior Member
USA
1218 Posts |
Posted - 11 February 2004 : 16:42:51
|
Laser's recommendations, I believe, will only work for your desktop.
Displaying XML on a website is fairly easy, though. I found some code on ASPIN and I use it to display RSS feeds from a variety of sites. The code I use works 90 percent of the time but the problem is you cannot control what code is produced in the RSS feed. So, if the RSS feed you're reading from isn't well-formatted, you may get errors.
If you can't find any samples that you recognize on ASPIN, I can post my code that reads the RSS info from a database and then fetches it from a website and displays it on my site. |
|
|
Jeepaholic
Average Member
USA
697 Posts |
Posted - 11 February 2004 : 21:25:19
|
Man, I just tried about four different scripts. None of them are working. Here's an example of one, which, I would expect to work but doesn't...
news.asp
<%
Function URLNewsItem(NewsURL)
Dim objHTTP
Dim objXML
Dim objXSL
Dim HowMany
Dim XMLNews
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.open "GET", "" & NewsURL & "", false
objHTTP.send
set objXML = objHTTP.responseXML
set objXSL=Server.CreateObject("microsoft.xmldom")
objXSL.async=false
objXSL.load(Server.MapPath("news.xsl"))
if (objXSL.readyState = 4 AND objXSL.parseError.errorCode = 0) then
HowMany = CountOccurances(objXML.transformnode(objXSL), "<tr>")
if (isnull(HowMany) or (HowMany ="")) then
Response.Write "Sorry, no headlines available at present!<br>"
else
URLNewsItem = (XMLNews)
end if
else
Response.Write "Error: " & objXSL.parseError.reason & "<br> URL:" & objXSL.url
end if
End Function
%>
<%
response.write URLNewsItem("http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/uk/rss091.xml")
%>
news.xsl
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="ISO-8859-1" omit-xml-declaration="yes" indent="yes" />
<xsl:template match="*">
<table border="0">
<tbody>
<tr><td class="title" width="200" bgcolor="#FFFFFF" height="22"><img src="linkarrow.gif" /><b>
<a class="title">
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='channel']/*[local-name()='link']" />
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']" />
</a></b>
</td></tr>
<tr><td valign="top" class="headlines" width="200">
<xsl:for-each select="//*[local-name()='item']">
<xsl:if test="position() < 10">
<img src="linkarrow.gif" />
<a>
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='link']" />
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<xsl:value-of select="*[local-name()='title']" />
</a>
<br />
</xsl:if>
</xsl:for-each>
</td></tr>
</tbody>
</table>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
I get a "Page Cannot Be Displayed" trying to access the news.asp file. http://www.jeepaholics.com/rss/news.asp
The XML URL included in news.asp seems to have content: http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/uk/rss091.xml
<shrug> Thoughts? |
Al Bsharah Aholics.com
Jeepaholics Anonymous Broncoholics Anonymous Network Insight
|
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 11 February 2004 : 22:23:49
|
this is the error I see:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'CountOccurances'
/rss/news.asp, line 23
|
|
|
Jeepaholic
Average Member
USA
697 Posts |
Posted - 12 February 2004 : 00:05:51
|
Huh, why can't I get the cool error messages?! <laughing>
Is CountOccrances even an ASP function? Looking at it more, I'm not even sure what XMLNews is?! It's never defined, as far as I can see.
I found this one: http://www.kattanweb.com/webdev/projects/index.asp?ID=7 ...which seems to be pretty nice from a theoretical standpoint, but can only get a live Yahoo News RSS feed to display...none of my own (not even their own sample write_rss.asp one works! Then, I tried copying the source of the Yahoo News RSS feed onto my server, naming it yahoonews.xml...then loading that one, but it doesn't work! This is beginning to make a whole lot of no sense to me.
Anyone having any better luck?
|
Al Bsharah Aholics.com
Jeepaholics Anonymous Broncoholics Anonymous Network Insight
|
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 12 February 2004 : 00:44:21
|
quote: Originally posted by Jeepaholic Anyone having any better luck?
here is the result using your files above (kinda):
http://www23.brinkster.com/richsnitz/news.asp
you can just remove the lines that refer to the CountOccurances function since it's not going to be used.
here is the contents of the news.asp file:<%
Function URLNewsItem(NewsURL)
dim objHTTP
dim objXML
dim objXSL
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.open "GET", NewsURL, false
objHTTP.send
set objXML = objHTTP.responseXML
set objXSL=Server.CreateObject("microsoft.xmldom")
objXSL.async=false
objXSL.load(Server.MapPath("news.xsl"))
if (objXSL.readyState = 4 AND objXSL.parseError.errorCode = 0) then
Response.Write(objXML.transformnode(objXSL))
else
Response.Write "Error: " & objXSL.parseError.reason & "<br> URL:" & objXSL.url
end if
end function
URLNewsItem("http://forum.snitz.com/forum/rssfeed.asp")
%>
and I had to make 1 change to your xsl file:
change this line:<xsl:if test="position() < 10"> to this:<xsl:if test="position() < 10">
|
|
|
Jeepaholic
Average Member
USA
697 Posts |
|
Jeepaholic
Average Member
USA
697 Posts |
Posted - 12 February 2004 : 01:31:36
|
BAH. Nevermind. I just figured something out...I've got DNS issues (on the inside). Long time bug with my NAT setup, argh. Nevermind. <laughing>
I wonder how many of these other scripts would have worked? Thanks for the help, sorry for the stupidity. GRR. |
Al Bsharah Aholics.com
Jeepaholics Anonymous Broncoholics Anonymous Network Insight
|
|
|
Topic |
|