Hi all,
This issue is driving me a little nuts.

I'm building a web based API to my database. I POST some data from  
Flex (or FMS), I get back XML. That works pretty well (but note I am  
not a CF programmer by trade...).

What I'm struggling with is suppressing all the whitespace in the XML.  
My CFM page essentially looks like this (simplified):

<cfsetting enablecfoutputonly="yes">
<cfprocessingdirective pageencoding = "utf-8" suppressWhiteSpace =  
"Yes">

<cfxml variable="userXML">
        <cfoutput><result action="none" status="error"></cfoutput>
        <cfoutput><message>no action defined</message></cfoutput>
        <cfoutput></result></cfoutput>
</cfxml>

<cfoutput>#toString(userXML)#</cfoutput>
</cfprocessingdirective>

If I hit this from FMS and trace the response I see this:


<?xml version="1.0" encoding="UTF-8"?>

<result action="none" status="error"><message>no action defined</ 
message></result>


It has a big fat empty line between the first and second line of  
content (I assume the first line is added on the fly by CF by me  
setting the page encoding).

I'm wondering what suppressWhiteSpace = "Yes" actually does because  
intially I did not wrap each line of my output in cfoutput tags, but  
that resulted in all the tab intends to be outputted as well.

Are there any best practices on how to format XML responses in CF?

And one more question: what exactly is returned to me if I omit the  
toString conversion on the last line (toString(userXML)) ? My FMS  
trace shows
coldfusion.xml.xmlnodel...@140e0f2
and I have no clue how I could then process that, which is why I ended  
up with toString (note FMS uses ActionScript 1 so I do not have the  
luxuries of E4X and the like for parsing, instead FMS is very picky  
when it comes to XML formatting).

Cheers

Stefan







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/flex/message.cfm/messageid:5830
Subscription: http://www.houseoffusion.com/groups/flex/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37

Reply via email to