Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
Mattastic #1
Creating rss feed with Coldfusion
Hi,
I'm getting the following xml errorswhen I'm trying to do this, can anybody
help?
----error----
XML Parsing Error: xml processing instruction not at start of external entity
Line Number 2, Column 114: SELECT * FROM news_articles ORDER BY
article_id DESC; </cfquery><cfsavecontent VARIABLE="theXML"><cfoutput><?xml
version="1.0" encoding="iso-8859-1"?><rss version="2.0">
--------------------------------------------------------------------------------
---------------------------------^
-----end error---
Thanks in advance
----code attached----
<cfsetting enablecfoutputonly="yes">
<cfquery name="newsArticles" datasource="news" username="#dsn_username#"
password="#dsn_password#">
SELECT * FROM news_articles ORDER BY article_id DESC; </cfquery>
<cfsavecontent VARIABLE="theXML">
<cfoutput>
<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0">
<channel>
<title></title>
<link></link>
<description></description>
<copyright></copyright>
</cfoutput>
<cfloop FROM="1" TO="#newsArticles.recordcount#" index="i">
<cfscript>
body = replace(newsArticles.body[i],"<","<","ALL");
body = replace(body,">",">","ALL");
body = replace(body,"&","&","ALL");
body = replace(body,"","","ALL");
date = dateformat(newsArticles.date_created[i], "ddd, dd mmm yyyy");
author = replace(newsArticles.author[i],"<","<","ALL");
</cfscript>
<cfoutput>
<item>
<TITLE>#newsArticles.heading#</TITLE>
<description>#lcase(body)#</description>
<LINK>
http://www.halesowen.ac.uk/</link>
<author>#author#</author>
<pubDate>#date#</pubDate>
<item>
</cfoutput>
</cfloop>
<cfoutput> </channel> </rss> </cfoutput></cfsavecontent>
<cfcontent TYPE="text/xml">
<cfoutput>#thexml#</cfoutput>
Mattastic Guest
-
Creating ColdFusion CMS
I am working on designing a RIA for my school district. I update the main site while others update individual school web pages. I want to make a... -
Problem Creating Coldfusion Datasource
Hello, I have installed MySQL 5.0.15 and Coldfusion MX 7 Developer Edition on my Mac Powerbook G4 running OS X 10.4.5. MySQL is working okay and... -
Creating an RSS feed
Has anyone created an rss feed? I need help. My RSS feed validates at feedvalidator.org but will not display in Mozilla. currently the file name... -
ADVICE: Need sheet feed scanner for creating Word doc's w/Acrobat
I need to scan about 1000 pages of mostly text, to be converted to Word documents and ultimately imported into InDesign. I have a flatbed scanner and... -
help with rss creating code creating an XML rss feed]
When I run the following code I get the follwing error and cant really see the problem I am incxluding this file from another page thanks in... -
Stressed_Simon #2
Re: Creating rss feed with Coldfusion
How are you loading the XML into a variable? If that is happening then you must
be reading the file with cffile? To read it as XML you will have to use cfhttp
so that the CF App Server can render the page. Otherwise you are just reading
in your template.
Stressed_Simon Guest
-
Mattastic #3
Re: Creating rss feed with Coldfusion
Thanks for the reply.
I see what you mean.
I have got it working now so it writes to a seperate xml file.
Is this the best way to do it?
I could set up a scheduled task to write to the file every so often to keep it
up to date?
Mattastic Guest
-
Stressed_Simon #4
Re: Creating rss feed with Coldfusion
The best way is to do as you suggested and write the xml file with a schedule. This way your data is kept up to date but you don't have to cope with serving dynamic data to aggregators.
Stressed_Simon Guest
-
kim.siever@gmail.com #5
Re: Creating rss feed with Coldfusion
Make sure the following are on the same line:
<cfoutput>
<?xml version="1.0" encoding="iso-8859-1"?>
like this:
<cfoutput><?xml version="1.0" encoding="iso-8859-1"?>
The XML tag MUST be the first thing in the page, no spaces or line
breaks or anything else before it.
[url]http://blog.hotpepper.ca/archives/2005/11/rss-and-coldfusion/[/url]
kim.siever@gmail.com Guest



Reply With Quote

