CFXML and CF tags gotcha

As i'm preparing to type this post what I'm about to says is so obvious its annoying. When you are using the <cfxml> tag you cannot have xml tags that begin with "cf" as Coldfusion tries to parse them. For example:

my data

Would fail with something like "A tag starting with 'CF' has been detected. This tag is not supported by this version of ColdFusion. Please verify your typo and try again.Unknown tag: cftest. "

The workaround: Modify the tag from <cftest> to <ctest> my dataThe afterwards get regex to make the changes.To explain the regex.
  • Attribute 1, is the string your are modifying.
  • Attribute 2, is the regex here. Here I am using creating a back reference (think of it as a variable) to catch the closing tag backslash.
  • Attribute 3, is the same as att. 2 but we remove the brackers and call the back reference via "\\1".
  • Tells us to capturing all occurances.

comments powered by Disqus