2

I'm currently using a combination of cffeed and cfoutput to generate an XLM/RSS feed, but am getting some curious output, which manifest differently with different browser settings(I think).

The ColdFusion code that produces the XML is

<cfset RssDetails= StructNew()>
<cfset RssDetails.version = "rss_2.0">
<cfset RssDetails.title = #someTitle#>
<cfset RssDetails.link = "someLink#">
<cfset RssDetails.description = #someDetails#>
<cfset RssDetails.pubDate = now()>
<cfset RssDetails.item = ArrayNew(1)>

<cfloop query="queryResults">
    <cfset RssDetails.item[currentRow] = structNew()>
    <cfset RssDetails.item[currentRow].title = #someResultTitle#>
    <cfset RssDetails.item[currentRow].description = structNew()>
    <cfset RssDetails.item[currentRow].description.value = #someResultData#>
    <cfset RssDetails.item[currentRow].link = "someResultLink#">
</cfloop>

<cffeed action="create" name="#RssDetails#" overwrite="true" xmlVar="someXML">

<cfoutput>#someXML#</cfoutput>

The basic output looks fine in a browser window, but if I then 'View Source' then there's several lines of 'whitespace' that are before and after the main body of XML. The format of the 'whitespace' when observed in 'View Source' is:

Whitespace

As mentioned above, the erroneous/additional output seems to vary with browser settings, although I've not worked out which ones yet, but ultimately, I'd like to remove the whitespace from the CF-generated XML, rather than rely on browser settings.

I've tried a couple of additional options in the cffeed command, but can't seem to hit a successful outcome...grateful for any thoughts or questions,

Phil

Miguel-F
  • 13,450
  • 6
  • 38
  • 63
Phil S
  • 123
  • 8
  • 1
    Older article but all of the options he mentions are still relevant to white space management in ColdFusion. Try these things - [ColdFusion Whitespace Options](https://www.raymondcamden.com/2006/07/26/ColdFusion-Whitespace-Options) – Miguel-F Apr 08 '20 at 13:17
  • Excellent, thanks Miguel...that was EXACTLY what I was looking for. – Phil S Apr 09 '20 at 14:31

0 Answers0