This content has been marked as final. Show 6 replies
A quick google search for "Coldfusion RSS" turned up a slew of articles, including this one:
Basically, you are going to create a coldfusion page that generates the RSS xml file either on a regular basis or whenever an update is made (your choice), after that its just a matter of supplying the feed URL to your users.
I have the blog entry form where end-user can submit the blog. When they hit the submit button for adding blog, I take these info and insert into the database and also write the xml file. I look at several examples from the web site and I try to do the same thing but keep getting an error. Please tell me what I did wrong here.
Here the error I got:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'file:///S:/scripts/rss/blog.xml'. Line 1, Position 1
Below is the code:
Use CFMXL to create the file. It will do better for formatting. And use CDATA also to validate correctly.
My code now is working fine but it is not working with the way I want. My query returned three records and the xml file should display three different records but it was display the same record for three times. What did I have wrong here?
You should be using cfxml instead of cfsavecontent. Your created a loop for the length of your result set but you didn't index anything. If your not going to use the query attribute of cfloop you need to index the variables: #author[ctr]# .
> <cfloop from="1" to = "#numberOfFeedItems#" index="ctr">
> <!--- Then output the fields for each item --->
change the above to:
your cfloop + cfoutput construct is wrong:
use just <cfoutput query="getblog"> instead of <cfloop ...><cfoutput>;
since your query already pulls only 3 top records only those will be
cfoutput'ed - no need to loop through anything;
alternatively, you can pull ALL records with your query (drop the TOP
#NumberOfFeedItems#) and then use <cfoutput query="getblog" startrow="1"