How do I use CDATA with E4X?
Reading CDATA nodes is easy. Sending, however, is hampered by the
fact that I cannot use binding within CDATA nodes, and all text is URL
encoded.
So, if I do this:
username = "Jesse";
lastname = "Warden";
<nodes>
<node>{username}</node>
<node><![CDATA[{lastname}]]></node>
</nodes>
It'll look like this:
<nodes>
<node>Jesse</node>
<node><![CDATA[{lastname}]]></node>
</nodes>
If I try assembling manually, it still URL encodes it:
var request:XML = <request>
<moo>
<goo>Hello</goo>
<pan>3</pan>
</moo>
</request>;
var sup:String = "sup dog";
var s:String = "<![CDATA[";
s += sup;
s += "]]>";
request.moo.appendChild(<gai>{s}</gai>);
trace(request);
This is a problem because I'm sending a URL through E4X with URL
parameters, and it's encoding it twice; basically, my & are becoming
&.
I asked the server guy to just let me send this particular value as an
attribute so we could move on, but... no dice, my problem.
???