Skip to main content
October 4, 2007
Question

creating xml file

  • October 4, 2007
  • 2 replies
  • 248 views
Hi

I have two includes and I would like to create this in xml file.

<cfcontent file="test.xml" type= "text/xml">
<cfinclude templete="tes1.cfm">
<cfinclude templete="tes2.cfm">

But it doesn't work and not throwing any error message. What is best way to create xml file using coldfusion. I used cfifle but i can't use include on it because cffile has a paramamter called variable and i can't pass cfinclude on it.

Thankx
This topic has been closed for replies.

2 replies

Inspiring
October 5, 2007
> But it doesn't work and not throwing any error message.

Oh come on.

Can you quantify "doesn't work"? Perhaps at least telling us what the
error message is might be a start...

--
Adam
BKBK
Community Expert
Community Expert
October 5, 2007
xmlTest.cfm
==========
<cfxml variable="myXMLDoc">
<cfinclude template="tst1.cfm">
<cfinclude template="tst2.cfm">
</cfxml>
<cfdump var="#myXMLDoc#">
<p>XML doc written to file c:\coldfusion8\wwwroot\website\myDoc.xml</p>
<cffile action="write" output="#myXMLDoc#" file="c:\coldfusion8\wwwroot\website\myDoc.xml">


tst1.cfm
=======
<myhtml>
<myhead>
<mytitle>xml test</mytitle>
</myhead>
<mybody>
first page body
</mybody>


tst2.cfm
=======
<mybody>
second page body
</mybody>
</myhtml>