URGENT: Coldfusion to XML

Posted on 2006-04-04
Last Modified: 2013-12-24
Hi guys, i need code that when i get info from my database that it turns it into an xml file on the fly onto the server, so i can use this for rss feeds! i have a table called completed this would be the query that i would use to show my data:

<cfquery name="addcbook" datasource="mybook">
select * from completed

the table fields are: bname,date,bauthor,bookss,bidss


Question by:Ianaldo
    LVL 12

    Accepted Solution

    <cfsavecontent variable="body">
          <cfoutput query="addcbook">

    <cffile action="write" file="path_on_server.xml" output="#body#">
    LVL 2

    Author Comment

    Hi know that kinda thing, thanks, but i need it to generate an xml file so that i can use the url of the generated xml file to allow for rss, so i need the whole xml generated, thanks!!
    LVL 18

    Expert Comment


    What mk has provided would work for you.

    Just build up the xml you require, then output the resulting variable (body in this example) at the end. No need to write it to the file.

    <cfsavecontent variable="myXml">
        <?xml version="1.0" encoding="UTF-8"?>
            <cfoutput query="addcbook">


    LVL 3

    Expert Comment

    Why the follow: complete code with dynamic variable all variable will show

    <cfsetting enablecfoutputonly="yes">
    <cfquery name="QueryCheck" datasource=#dbname#>
          SELECT      *
          From      ClientDB
    <cfsetting enablecfoutputonly="no">
    <cfparam name="FileName" default="myfilename">      
    <cfheader name="Content-Disposition" value="filename=#FileName#">
    <xml id="QueryResult">
          <QueryRes><cfoutput query="QueryCheck">
                      <RowCount>#QueryCheck.CurrentRow#</RowCount><cfloop list="#QueryCheck.Columnlist#" index="Fields">

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
    The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
    The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now