Skip to main content
Participant
August 21, 2009
Question

Does CDATA text in a TextField show up in CS4?

  • August 21, 2009
  • 1 reply
  • 562 views

1. Create a new Dynamic Text field.

2. Set its htmlText like this:

text1.htmlText = '<![CDATA[This text used to show up in CS3.]]>';

I see nothing.

(Which is bad for the large department-wide content management system we just converted to CS4.)

Can anyone else confirm this behavior?

Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 21, 2009

i don't think that would work in cs3, either.

a cdata node should be part of an xml instance.  if you used:

var xml:XML=new XML('<![CDATA[This text used to show up in CS3.]]>');

text1.htmlText=xml.toString();

it would probably work as expected.

c_barrowsAuthor
Participant
August 21, 2009

Thanks!  That helped me track down the discrepancy.  The problem was some code that worked well enough to get by with in CS3 but, iny my opinion, CS4 handles more properly now.

In CS3, I was doing this:

var xml : XML = new XML(<bob>Bob was here</bob>);

xml.replace(0, "<![CDATA[Larry is here now]]>");

trace(xml.toXMLString());

And the trace was this (as desired):

<bob><![CDATA[Larry is here now]]></bob>

However, in CS4 the trace output is (not so good):

<bob>&lt;![CDATA[Larry is here now]]&gt;</bob>

So changing the second parameter of the "replace" to be XML rather than a string -- as it probably should have been in the first place -- cleared it up.

And here I was blaming CS4.  Silly me.

kglad
Community Expert
Community Expert
August 21, 2009

you're welcome.