...

View Full Version : Help with RSS in ASP Please



Rik Comery
01-29-2007, 02:37 PM
Hi. I have a problem which i think is quite odd. I have built an XML file for an RSS feed, and everything is working great.

However, i have a need to build the XML data dynamically. I therefore saved my XML file as an ASP page and built a little script that created the item nodes. This failed. To cut a long story short, the problem is not with the ASP code, but with the fact that the page is an ASP page.

If you take a look at the code at the bottom of this post (Shamelessly stolen from the BBC website for testing), you will see there is no ASP in it. In fact, if it is saved with an .xml extension, all is good.

However, save the file with an .asp extension and the page doesn't even open in my web browser. It just hangs and after about 5 minutes, crashes. I have pinpointed where the problem is. it is the "greater than" character at the beginning of <channel>. Remove that and the page opens - albeit incomplete.

I have the same problem in Internet Explorer (all versions), Netscape Navigator version 8 and Opera. It also happens on three of my collegues PC's, indicating it is not my PC that is at fault, but the actual file

Can anyone explain?

<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>BBC News | News Front Page | UK Edition</title>
<link>http://news.bbc.co.uk/go/rss/-/1/hi/default.stm</link>
<description>Visit BBC News for up-to-the-minute news, breaking news, video, audio and feature stories. BBC News provides trusted World and UK news as well as local and regional perspectives. Also entertainment, business, science, technology and health news.</description>
<language>en-gb</language>
<lastBuildDate>Mon, 29 Jan 2007 12:07:41 GMT</lastBuildDate>
<copyright>Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/1/hi/help/rss/4498287.stm for terms and conditions of reuse</copyright>
<docs>http://www.bbc.co.uk/syndication/</docs>
<ttl>15</ttl>
<image>
<title>BBC News</title>
<url>http://news.bbc.co.uk/nol/shared/img/bbc_news_120x60.gif</url>
<link>http://news.bbc.co.uk/go/rss/-/1/hi/default.stm</link>
</image>

<item>
<title>Ex-soldier admits killing family</title>
<description>A former serviceman admits the manslaughter of four members of his family who were found shot dead.</description>
<link>http://news.bbc.co.uk/go/rss/-/1/hi/england/tyne/6309169.stm</link>
<guid isPermaLink="false">http://news.bbc.co.uk/1/hi/england/tyne/6309169.stm</guid>
<pubDate>Mon, 29 Jan 2007 11:48:00 GMT</pubDate>
<category>Tyne</category>
</item>
</channel>
</rss>

angst
01-29-2007, 09:04 PM
I ran into this problem last year, i just used FSO and wrote the rss feed out to an .xml file.

however, i know that there is a way to do it directly from an asp by specifing the contact type.

angst
01-29-2007, 09:05 PM
ah i think this is it:



Response.contenttype = "text/xml"


just insert at the top of the page.

Rik Comery
01-30-2007, 08:54 AM
That is it. Works like a charm. Thanks for your help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum