What are most likely sources of whitespace that can affect event.renderData?

Running CB SVN with CF9

A. Setup: I have a handler with an event that has uses
event.renderData to render an xml version of the cookie scope.

<cfset event.renderData(type="XML",data=cookie)>

B. Problem: The problem is that I have some whitespace appearing
before the XML and XML nevers likes that.

C. Analysis so far:

1. If I restart the coldfusion service and hit that event first, it
works perfectly without any whitespace.
2. If I restart the coldfusion service, hit an alternate event first,
and then hit the cookie event, it does not work. The white space is
present.
3. When I view the source of the bad xml, the xml is valid except for
the whitespace before and after it.

renderData() removes the views and the layouts so I'm not looking at
those as the culprits. The fact that it works before the framework is
loaded and has cached anything is a step forward and has me looking at
interceptors, plugins, request context decorator...well anything
except the views and layouts as it appears they're not in play when
renderdata is used.

Anyone have some insight into what's the most likely source for extra
whitespace when using event.renderData()?

Thank you,
Gabriel

Gabriel,

I have not seen this issue on any of my projects. There has to be something as the culprit here. Whitespace is such a horrible thing in cf. Make sure that you have output=false everywhere.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

also make sure that “enable whitespace management” is checked in CF Admin

@Luis,

It’s likely something in my code. As part of my testing, I got the simple template running and it did not experience this behavior.

I’m hopeful someone may have come across and interceptor or a plugin that experienced something like this but I’m aware it’s a hail mary pass. :slight_smile:

@Marc,

Whitespace management is not enabled in CF but the simple template works without it being enabled so my app should work as well. “tear everything apart” debugging here I come. :frowning:

  • Gabriel

I found the solution. In the Application_noinheritance.cfc file, there is line right at the top that says:

With this line, both my app and the advanced template work. Without this line, both my app and the advanced template break when rendering the xml using event.renderData().

Thanks again,
Gabriel

Thank you everyone.You have kept me informed,I din't know about
this.lets keep it burning.