Reputation: 13
I am using the following query to output XML from sql query
select * from author FOR XML RAW, ROOT ('data'), ELEMENTS XSINIL
Data is coming as expected, from CF point of view i am using this
DECLARE @XmlData XML;
SET @XmlData =(#preserveSingleQuotes(abovequery)#)
SELECT @XmlData AS Result
now when i dump it, it considers it as a string and display the xml elements in there
my Data
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<authorid>5</authorid>
<firstname>joker</firstname>
<lastname>movie</lastname>
<sorted>1</sorted>
<createdon xsi:nil="true" />
<modifiedby xsi:nil="true" />
</row>
</data>
I want to display exactly like the above on screen, but when i either using use cfxml or xmlparse or xml any other element, it does not display in that format, it just extract the values and display it in one line
how can i fix it
Upvotes: 0
Views: 82
Reputation: 11120
How about
<cfsavecontent variables="Result"><data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<authorid>5</authorid>
<firstname>joker</firstname>
<lastname>movie</lastname>
<sorted>1</sorted>
<createdon xsi:nil="true" />
<modifiedby xsi:nil="true" />
</row>
</data></cfsavecontent>
<pre><cfoutput>#EncodeForHTML(Result)#</cfoutput></pre>
Upvotes: 3