The woes of using undocumented stuff in CF

Today I got a very interesting issue. I was working on some code written by somebody else who is (obviously when running in one of “those” issue) not in the company anymore. It was part of Novasphere, a CMS engine we use at ZeroOne.

When I was trying to set up a new Novasphere instance on a CF 7 box I wondered that some functionalitites didn’t work. My colleague Max and I started debugging it and found that the developer used a .toString() Java function to access the content of ColdFusion XML objects (Important: we’re not talking about the CF function ToString() here). This worked fine on CF 6 but not on CF 7 anymore as I assume Macromedia updated the internal Apache Xerxes engine for XML to a newer version.

Here’s some code:

<cfxml variable="myXML">
<user>
	<name>Kai Koenig</name>
	<age>31</age>
	<skills id="1">
		<role>coach</role>
		<type>training</type>
	</skills>
	<skills id="2">
		<role>architect</role>
		<type>development</type>
	</skills>
</user>
</cfxml>
<cfdump var="#myXML#">
<cfoutput>
#myXML.user.toString()#
</cfoutput>

On CF6 this creates:

Kai Koenig 31 coach training architect development

On CF7 you’ll end up with:

[user: null]

What’s my point? Always be careful when using undocumented and unofficial stuff!

Post to Twitter Post to Delicious Post to Facebook Post to StumbleUpon

Related posts

  • Sorry, could not find any...
This entry was written by kai, posted on Monday February 20 2006 at 12:02 am, filed under Agent K on CF, Agent K on Java . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

3 Responses to “The woes of using undocumented stuff in CF”

  1. #toString(myXML.user)# does work with CF7.

    Cheers,

    ~Rob

  2. For what it’s worth, the “correct” way to do this (at least on CF7) is:

    #toString(myXML.user)#

  3. Sean, Rob, you’re right. But as mentioned in the post, that’s not what this is about. It is supposed to work cause it’s documented and the official way – opposed to myXML.user.toString()…;-)

Leave a Reply