Skip to main content
Known Participant
March 15, 2007
Question

Mozilla RSS error

  • March 15, 2007
  • 4 replies
  • 506 views
Hi, I have 2 rss questions that I hope you can help me with
1.)I tried to use " http://www.adobe.com/cfusion/webforums/forum/rss.cfm", adobe's rss feed on http://www.feedvalidator.org but it does not validate, but why is it still used?

2.)the code (below) works in IE, but when I open rss.cfm in Firefox, I get error message: XML Parsing Error: xml declaration not at start of external entity Location: http://soohoo/crimestoppers/test/rss.cfm
Line Number 2, Column 1:" How can I fix this? Thanks so much -C

<!---My code...--->
<cfset NumberOfFeedItems = 10>
<!---
<cfquery name="getLatestPublishedArticles" datasource="yourDB">
SELECT TOP #numberOfFeedItems# *
FROM yourContent
ORDER BY PublishedDate DESC
</cfquery>
--->

<cfset theDatetime = "#dateformat(now(), "ddd, dd mmm yyyy")# #timeformat(now(), "HH:mm:ss")# PST">

<cfsetting enablecfoutputonly="yes">
<cfsavecontent variable="theXML">

<cfoutput>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- RSS generated by DevX on #theDatetime# -->
<rss version="2.0">
<channel>
<title>DevX Featured Content</title>
<link> http://www.devx.com</link>
<description>Latest DevX Content</description>
<language>en-us</language>
<copyright>Copyright 2002 DevX</copyright>
<docs> http://backend.userland.com/rss</docs>
<lastBuildDate>#theDatetime#</lastBuildDate>
<image>
<title>DevX</title>
<url> http://www.devx.com/assets/devx/3182.gif</url>
<link> http://www.DevX.com</link>
</image>
</cfoutput>

<cfloop from="1" to = "#numberOfFeedItems#" index="ctr">

<cfscript>
title = "titleXXX";
description = "titleXXX";
description = "titleXXX";
date = "titleXXX";
time = "titleXXX";
authors = "titleXXX";
pubDate = date & " " & time;
</cfscript>

<cfoutput>
<item>
<title>#title#</title>
<description>#description#</description>
<link> http://www.devx.com/content/id/</link>
<author>#authors#</author>
<pubDate>#pubDate#</pubDate>
</item>
</cfoutput>
</cfloop>

<cfoutput>
</channel>
</rss>
</cfoutput>

</cfsavecontent>

<cffile action="write" file="C:\Inetpub\wwwroot\Crimestoppers\test\rssXml.xml" output="#theXml#">

<cfcontent type="text/xml">
<cfoutput>#theXml#</cfoutput>


This topic has been closed for replies.

4 replies

Known Participant
April 11, 2007
Hi Azadi, my apologies for the late reply but thanks so much for your response ! You are right, I had a blank space at the top, that's what caused the error.

Thanks so much,
C.
Inspiring
March 16, 2007
after you load your rss.cfm in FF, view the page's source to see what's
actually being displayed - your rss feed or some cf/server error...
also in the source view check that the <?xml...?> line is THE FIRST LINE
on the page, with NO blank or text lines before it.

i think a dev version of CF puts a comment line "dev edition. not for
production use blah blah" on the first line of every page it processes,
so if you a checking your rss on a dev edition of CF that may cause the
problem. it also makes the rss feed fail validation.

technically, you can do without the <?xml ...> line in your file
completely... the rss feed will still validate (though with a warning,
but which is only visible when you try to validate the rss - your users
will not see any difference).

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Known Participant
March 15, 2007
Hi Ian, I'm studying the code from:
http://www.webpronews.com/topnews/2004/04/05/creating-your-very-own-rss-xml-feeds-with-coldfusion-mx?destination=node%2F9624
I basically googled "Coldfusion rss example" for this, can you try this? or maybe do you know a working better example?
Thanks so much,
-C
Inspiring
March 15, 2007
Are you sure that the access is returning your expected RSS feed and not
some http error or something else that is trying to be inturpeted as an
XML RSS feed?

I doubt this is the issue, but I like to wrap everything before the
<?xml...?> prolog in a <cfsilent></cfsilent> block to control any
extraneous white space which can sometimes cause problems.