all groups > flash actionscript > september 2004 >
You're in the

flash actionscript

group:

using entity references (sensitive chars) in xml



using entity references (sensitive chars) in xml OOPete
9/6/2004 7:20:00 PM
flash actionscript: Hi, I've just started out with XML and loading it into Flash.

I can't seem to get those sensitive characters to display correctly. i.e.
putting '&lt;' in my XML doc brings up '&lt;' as opposed to '<' in the flash
movie. and using CDATA doesn't seem to work either

can anyone tell me what is going on?

Many thanks,

Pete O'Brien
Re: using entity references (sensitive chars) in x _jrh_
9/6/2004 7:41:17 PM
I have still not figured out why Flash doesn't import the characters properly.
Someone gave me this code a little while back and it works for me. It's a quick
fix, but it works:

cleanText = function (txt) {
txt = txt.toString();
txt = txt.split("&apos;").join("'");
txt = txt.split("&quot;").join("\"");
txt = txt.split("&amp;").join("&");
return txt;
}

Just use that function to clean the special characters. Add any extra ones you
may need.
AddThis Social Bookmark Button