[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Creating an XML file with ColdFusion

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!!!!
0
IRHusker
Asked:
IRHusker
  • 2
1 Solution
 
Russell2566Commented:
<cfsaveconent variable="xmlString">
<!--- XML CREATION CODE HERE--->
</cfsavecontent>

<cffile action = "write" file = "c:\myXml.xml" output="#xmlString#">
0
 
IRHuskerAuthor Commented:
Thanks Russell!

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?
0
 
Russell2566Commented:
There is a spelling error in my code... correct the spelling for the opening tag...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now