Patrick
Patrick

Reputation: 2577

Output coldfusion xml as raw text

Any time I try to output coldfusion xml, it removes the tags. How can I print it to screen in its raw format?

Upvotes: 0

Views: 1355

Answers (1)

Adrian J. Moreno
Adrian J. Moreno

Reputation: 14859

So <myXmlRoot> is showing as myXmlRoot?

It's not removing the tags, you're trying to display XML as a string and the browser thinks that everything within < and > is an HTML tag. if you did a view-source, you'll see the original XML.

If you're on CF 10+, you can run the XML string through the function encodeForHTML(), which will convert what it sees as HTML entities to their relative ASCII values. Previous to CF 10, try htmlEditFormat().

<cfoutput>#encodeForHTML(myXML)#</cfoutput> will show the full content of your XML.

Upvotes: 4

Related Questions