Skip to main content
Known Participant
October 9, 2008
Question

cffile and xml

  • October 9, 2008
  • 2 replies
  • 575 views
Hi everyone,
Can the following code
<CFFile Action="Write"
file="test.xml"
output="have a nice day"
>
create a xml file?
I want to create a xml file using the CFFile command.

Thanks
    This topic has been closed for replies.

    2 replies

    Inspiring
    November 5, 2008
    Look up the use of the CFXML tag. It will properly format the XMl data for you.

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_u-z_4.html
    Inspiring
    October 9, 2008
    Lei Hu wrote:
    > Hi everyone,
    > Can the following code
    > <CFFile Action="Write"
    > file="test.xml"
    > output="have a nice day"
    > >
    > create a xml file?

    Well, no since the output 'have a nice day' is not valid XML.
    Otherwise, if you output something like, let us say '<aRoot>have a nice
    day</aRoot>' -- or a variable that contained this --, that *was* bare
    minimum, valid XML data, then you would have an xml file.

    In other, less sarcastic, words. Yes <cffile ...> can write XML, or any
    other text based, data to a file with easy.

    It can even do something with binary files, but that takes more
    knowledge and has more restrictions.
    Lei_HuAuthor
    Known Participant
    November 4, 2008
    Thanks a lot, it worked. I enjoy your sense of humor. I really meant to have all the content in the xml file in the tag (and it is now in the file), but I forgot to do it when posting the questions.