[flexcoders] Re: Encoding XML Character Entity References *properly*

2010-02-05 Thread valdhor
Try this: private function htmlEscape(str:String):String { return XML(new XMLNode(XMLNodeType.TEXT_NODE, str)).toXMLString(); } It uses the legacy ActionScript 2 object. I don't know how long this will stay around but it is included in the latest 3.5SDK (Not sure about 4). HTH Steve ---

[flexcoders] Re: Encoding XML Character Entity References *properly*

2010-08-19 Thread pmorch
I figured it out: > new XML("" + xmlEscape(string) + ""); is better done as: > new XML({string}); See also: http://stackoverflow.com/questions/1856726/how-do-you-encode-xml-safely-with-actionscript-3/

Re: [flexcoders] Re: Encoding XML Character Entity References *properly*

2010-08-22 Thread dorkie dork from dorktown
var x:XML = new XML(); var b:String = "a string/& lkj l"; x.appendChild(b); textarea.text = x.toXMLString(); does this work for you? it is for me. also what SDK FP version are you using? are you using as3corelib? there is an xmlutil.isvalid method that you can use On Thu, Aug 19, 2010 at 8:21

Re: [flexcoders] Re: Encoding XML Character Entity References *properly*

2010-08-23 Thread Oleg Sivokon
Both your variants are... strange... you use literal and create a new object by passing it an already created object... var xml:XML = {bar}; This is how you'd normally do it. E4X uses couple of special opcodes allocated only for it, so, my guess that using E4X expressions for constructing XMLs sh