<cfsetting enablecfoutputonly="yes">

<CFQUERY NAME="qGetTutorials" datasource="MyDSN">
   SELECT *
   FROM    Tutorials
   WHERE  Tutorial_status = <cfqueryparam cfsqltype="CF_SQL_INTEGER" null="no" value="1">
   ORDER   BY tutorial_id
</CFQUERY>

<cfsavecontent variable="theXML">
<cfoutput><?xml version="1.0" encoding="ISO-8859-1" ?>
  <!-- RSS generated by EasyCFM.COM, LLC. on #now()# -->
  <rss version="2.0">
    <channel>
       <title>EasyCFM.COM Tutorials</title>
       <link>http://www.easycfm.com</link>
       <description>All the EasyCFM.COM Tutorials!</description>
       <language>en-us</language>
       <copyright>Copyright 2003 EasyCFM.COM, LLC.</copyright>
       <docs>http://backend.userland.com/rss/</docs>
       <lastBuildDate>#dateformat(now(), "ddd, dd mmm yyyy")# #timeformat(now(), "HH:mm:ss")# EST</lastBuildDate>
       <image>
            <title>EasyCFM.COM</title>
            <url>http://www.easycfm.com/images/logo.gif</url>
            <link>http://www.easycfm.com</link>
       </image>
</cfoutput>

<cfloop from="1" to="#qGetTutorials.RecordCount#" index="ctr">
    <!--- Here let's clean up and ensure that all values are XML Compliant --->
    <cfscript>
       title = replace(qGetTutorials.tutorial_title[ctr], "<", "&lt;", "ALL");
       description = replace(qGetTutorials.tutorial_description[ctr], "<", "&lt;", "ALL");
       description = replace(description, "&", "&amp;", "ALL");
       description = replace(description, '"', "'", "ALL");
       date = dateformat(qGetTutorials.tutorial_posted_date[ctr], "ddd, dd mmm yyyy");
       time = timeformat(qGetTutorials.tutorial_posted_date[ctr], "HH:mm:ss") & " EST";
       author = replace(qGetTutorials.tutorial_author[ctr], "<", "&lt;", "ALL");
       author_email = replace(qGetTutorials.tutorial_author_email[ctr], "at>", "@", "ALL");
       author_email = replace(author_email, "<", "&lt;", "ALL");
   </cfscript>

   <!--- this is the area your users will really want, these are the actual RSS items.. where you have your news or your content itself ---> 
   <cfoutput>
   <item>
         <title>#title#</title> 
         <description>#description#</description>
         <link>http://tutorial#qGetTutorials.tutorial_id[ctr]#.easycfm.com</link>
         <author>#author_email# (#author#)</author>
         <pubDate>#date# #time#</pubDate>
   </item>
   </cfoutput>
</cfloop>
<cfoutput>
</channel>
</rss>
</cfoutput>
</cfsavecontent>

Now you have the option of load this from this file or you can save it to an actual .XML file, that choice is up to you! What's the difference you ask?

It's in the way you want your users to have access to your data... if you do it with the CFML file then they will be querying your database and generating the latest data every time, but they will be processing databases and COldFusion (which could slow your machine down). If you put it in an XML file, the data will not be the most recent, but no processing will be required at time of call by user. So the choice is up to you!

If you want to write, simply do this:
<cffile action="write" file="#expandPath(".")#\EasyFeed.xml" output="#theXml#">

If you want to process with the CFML file, simply add this:

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