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:
ColdFISH is developed by Jason Delmore. Source code and license information available at coldfish.riaforge.org <cfxml variable="xml1">
<myXml>
<cftest>my data</cftest>
</myXml>
</cfxml>1<cfxml variable="xml1"> 2<myXml> 3<cftest>my data</cftest> 4</myXml> 5</cfxml>
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. "
Assuming you're trying to do some kind of CFML code generation, can you dynamically generate the CFML contents of the XML doc through string concatenation and then output that at runtime in the CFXML block?
And if you use any other tag starting with a "c", such as caption, cite, code your code will break it, so probably better to go with a multicharacter replacement, than just the "c".
Which version of CF are you using for this experiment? On my 6.1 I have to work with, when I cfdump xml2 after the ReReplace, I get something like the following: coldfusion.xml.XmlNodeList@ac3205 rather than the "normal" structure dump that I get if I dump the variable prior to the ReReplace.
Depending on your situation, another option might be to write the XML to a file and then get the contents of the file from cffile and pass them into cfxml.
That just seems goofy. I think I would consider that a bug of some sort unless there is a proscribed method for dealing with the situation. I haven't tried this, but might a workaround be to use a namespace? I don't think the cfxml tag will care.
@Mike Rankin, I thought it might be a bug as well but at the end of the day <cf should initiate a ColdFusion tag. If anything there should (and might be) a way to escape it.
@Danilo, Im running my code on 7.02. Have you tried just outputting the code in a CF output block, It might make a difference?
@Everyone else, I wasn't trying to do some CF generation, I was actually building an XML doc for a client which required a tag to begin with <cf. Steve, thanks for the idea. I've just created cfset starttag = "<cf" /> cfset endtag = "</cf" />