Steps
1) The change in the type of the file to be created in
CFCONTENT TYPE tag will solve this problem. Here it is XML type.
<CFHEADER NAME="Content-Disposition" VALUE="INLINE; FILENAME=filename.xml">
<CFCONTENT TYPE="application/XML" DELETEFILE="yes">
Deletefile=”yes” will delete the files from the directory
after sending it to the client. If a user wants to be prompted with an option
to save the file or open it in the browser then the value="inline will
solve this.
Listing 6
<CFHEADER NAME="Content-Disposition" VALUE="INLINE; FILENAME=test.xml">
<CFCONTENT TYPE="application/XML" DELETEFILE="yes">
<Book>
<Author>Abraham Linkon</Author>
<Price>Rupees 500</Price>
</Book>
This will create an .xml file which can be opened in a
browser and can be used independently in subsequent ColdFusion pages as
ordinary .xml files.