Hi everyone,

It is a bit outdated topic of AS2.0. I just wonder if somebody can
explain me why onLoad and (inderectly) onData produces different
CDATA node values. I lost a lot of time trying to figure this out,
searching the Web did not help much...

Let's consider an XML file source:
  <node><![CDATA[&lt;]]></node>


1) After loading to an XML object, when tracing the xml in its onLoad
handler, the output is:
   <node>&lt;</node>

When trying to pass the CDATA node's nodeValue to a HTML enabled text
field (as html text), then the text field is blank. The reason is that
nodeValue returns a single character "<" instead of "&lt;", so the
html text field tries to open a html tag displaying nothing...


2) When capturing onData and creating a new XML object from raw XML
file source like this:

     xml.onLoad=function(source){
        var newXML = XML(source);
        trace(newXML);
     }

...then the trace outputs:
   <node>&amp;lt;</node>     (the ampersand is converted !)

After passing CDATA node's nodeValue to an HTML text field I got:
   <   (less than)
... as want and expected. The nodeValue returned "&lt;" this time
instead of the single less-than character.

I couldn't find a way to display less-than after capturing onLoad
other than writing in the xml file:
  <![CDATA[.....&amp;lt;....]]>
Is this an onLoad parsing bug of the Flash Player ? Or maybe using
onLoad is just not a good idea and should be avoided ? I have a number
of onLoad handlers around in a big project, probably all need
conversion... 

Thanks,

Greg





_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to