Skip to main content
Participant
October 4, 2007
Question

Creating an XML file with CF

  • October 4, 2007
  • 8 replies
  • 743 views
I need to loop through a query to create an xml file. How do I create a file using CF? I thought maybe cffile but I don't see an attribute for "new", just things like append, delete, move etc... Am I missing something here? I've used cfheader to send content to the browser but just not sure how to create a file and place in on the server.

Any help would be appreciated GREATLY!!!!
This topic has been closed for replies.

8 replies

October 5, 2007
thanks you to.

It is so easy to do, I am my own worst enemy when typing code
Participant
October 5, 2007
DOH!

Many thanks Sam! Have a great day!
Inspiring
October 5, 2007
SamNUK wrote:
> you are missing a t
>
> <cfsavecontent variable="xmlString">
> <!--- XML CREATION CODE HERE--->
> </cfsavecontent>
>
> should work now

Or a subtle misspelling in the email that I did not see! Good eye SamNUK.
Inspiring
October 5, 2007
That looks just fine in the email. I do stuff just like this all the time.

Are you sure there isn't a subtle typo in your code? Maybe a
misspelling of "cfsavecontent" somewhere?



October 5, 2007
you are missing a t

<cfsavecontent variable="xmlString">
<!--- XML CREATION CODE HERE--->
</cfsavecontent>

should work now
Participant
October 5, 2007
Thanks to both of you. I'll look through the tutorial now.

I was also given the sample code below but receive an error.
<cfsaveconent variable="xmlString">
<!--- XML CREATION CODE HERE--->
</cfsavecontent>

<cffile action = "write" file = "c:\myXml.xml" output="#xmlString#">

When I try this approach I get the following error:
"Context validation error for tag cfsavecontent.
The end tag </cfsavecontent> encountered on line 28 at column 3 requires a matching start tag. "

At first I thought it was the XML I was trying to insert there but even if I remove all content in the <!--- XML CREATION CODE HERE---> section I still get the error. The XML als test fine on it's own.

Any thoughts?
Inspiring
October 5, 2007
Give <cffile action="write" ...> a shot. All the details are in the
documentation either locally or on the internet.

Inspiring
October 5, 2007
See if this helps:

http://tutorial97.easycfm.com/

--
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com


"cfcolorado" <webforumsuser@macromedia.com> wrote in message news:fe3poc$cvf$1@forums.macromedia.com...
>I need to loop through a query to create an xml file. How do I create a file
> using CF? I thought maybe cffile but I don't see an attribute for "new", just
> things like append, delete, move etc... Am I missing something here? I've
> used cfheader to send content to the browser but just not sure how to create a
> file and place in on the server.
>
> Any help would be appreciated GREATLY!!!!
>