This content has been marked as final. Show 2 replies
> I was impressed with the XmlFormat functionality.... until I realized
> that it didn't convert everything into "an XML-readable format" as the
> literature seems to indicate. It does well when handling non-String data type
> conversions but not-so-well with strings containing characters antithematic to
> XML, including characters such as "<", ">", "@", quotes and apostrophes.
Err... what makes you say that?
xmlFormat() performs the following transitions:
< => <
> => >
' => '
@ => [no change, none necessary]
& => &
" => "
That certainly covers all the things your function does, with the added
bonus that it does it correctly (which yours doesn't, see below).
What are you seeing that it's doing wrong?
> REReplace(inString, "<", "<", "All");
> REReplace(inString, ">", ">", "All");
This could be how the newsfeed parses data, but from where I'm sitting,
you're swapping the angle brackets for... the same angle brackets.
> REReplace(inString, "@", "&", "All");
An @ is not an &
> REReplace(inString, '"', ''', 'All');
Hang on. You're swapping out an apostrophe for an ' - fair enough -
but then swapping out a double-quote for an apostrophe. That doesn't seem
I expect xmlFormatFormat() probably has that one nailed correctly with the
You're right in that I mistyped "@" for "&"... Next time I'll copy/paste.
As to my lack of confidence in XmlFormat... I've found that it works well if you use it like:
<cfset abc = XmlFormat(#inputString#) />
but doesn't in this context:
<cfcontent type="text/xml"><?xml version="1.0" encoding="UTF-8" ?><myRoot><abc parm1="#XmlFormat(#inputString#)#" /></myRoot>