Skip to main content
June 15, 2006
Answered

Display XML

Hi,

I have a CFM file where it should receive a URL query string make some process and then display the output as XML (it will be dynamic XML), so the XML is displayed on the browser , the XML is displayed as a text not a group of tags like any regular XML with + and - signs , is there anything should be considered?.
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
June 15, 2006
I think I found the solution , see the code below

<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<cfcontent type="text/xml">
<cfoutput>
<?xml version="1.0" encoding="utf-8"?>
<menu name="Menu">
<item>
<text>Home</text>
<link>/index.cfm</link>
</item>
<menu name="Products">
<item>
<text>JRun</text>
<link>/products/jrun.cfm</link>
</item>
<menu name="ColdFusion">
<item>
<text>ColdFusion Professional</text>
<link>/products/cfpro.cfm</link>
</item>
<item>
<text>ColdFusion Enterprise</text>
<link>/products/cfent.cfm</link>
</item>
<item>
<text>ColdFusion for J2EE</text>
<link>/products/cfj2ee.cfm</link>
</item>
</menu>
<item>
<text>Flash</text>
<link>/products/flash.cfm</link>
</item>
<item>
<text>Dreamweaver</text>
<link>/products/dw.cfm</link>
</item> </menu>
<item>
<text>Search</text>
<link>/search.cfm</link>
</item><item>
<text>Login</text>
<link>/logout.cfm</link>
</item>
</menu>
</cfoutput>

3 replies

Correct answer
June 15, 2006
I think I found the solution , see the code below

<cfsetting enablecfoutputonly="yes" showdebugoutput="no">
<cfcontent type="text/xml">
<cfoutput>
<?xml version="1.0" encoding="utf-8"?>
<menu name="Menu">
<item>
<text>Home</text>
<link>/index.cfm</link>
</item>
<menu name="Products">
<item>
<text>JRun</text>
<link>/products/jrun.cfm</link>
</item>
<menu name="ColdFusion">
<item>
<text>ColdFusion Professional</text>
<link>/products/cfpro.cfm</link>
</item>
<item>
<text>ColdFusion Enterprise</text>
<link>/products/cfent.cfm</link>
</item>
<item>
<text>ColdFusion for J2EE</text>
<link>/products/cfj2ee.cfm</link>
</item>
</menu>
<item>
<text>Flash</text>
<link>/products/flash.cfm</link>
</item>
<item>
<text>Dreamweaver</text>
<link>/products/dw.cfm</link>
</item> </menu>
<item>
<text>Search</text>
<link>/search.cfm</link>
</item><item>
<text>Login</text>
<link>/logout.cfm</link>
</item>
</menu>
</cfoutput>
Translate
June 15, 2006
Try #HTMLEditFormat(XMLStringGoesHere)#
Translate
June 15, 2006
Thanks, but still it is not working , see the code below just for testing , i'm running it through a CFM file in the browser , i can only see it as text , I tried CFXML but didn't work too , I'm running CFMX 7 , thanks for any help!

<cfsavecontent variable="test">
<?xml version="1.0" encoding="utf-8"?>
<menu name="Menu">
<item>
<text>Home</text>
<link>/index.cfm</link>
</item>
<menu name="Products">
<item>
<text>JRun</text>
<link>/products/jrun.cfm</link>
</item>
<menu name="ColdFusion">
<item>
<text>ColdFusion Professional</text>
<link>/products/cfpro.cfm</link>
</item>
<item>
<text>ColdFusion Enterprise</text>
<link>/products/cfent.cfm</link>
</item>
<item>
<text>ColdFusion for J2EE</text>
<link>/products/cfj2ee.cfm</link>
</item>
</menu>
<item>
<text>Flash</text>
<link>/products/flash.cfm</link>
</item>
<item>
<text>Dreamweaver</text>
<link>/products/dw.cfm</link>
</item> </menu>
<item>
<text>Search</text>
<link>/search.cfm</link>
</item><item>
<text>Login</text>
<link>/logout.cfm</link>
</item>
</menu>
</cfsavecontent>
<cfoutput>
#HTMLEditFormat(test)#
</cfoutput>
Translate