var cdata:XML = new XML("<![CDATA[" + s + "]"+"]>");On 9/12/07, discoguy77 <[EMAIL PROTECTED]> wrote: > > Ignoring whitespace isn't a good option, because my server-side > program doesn't ignore whitespace. > > The script you wrote causes a parse error, because the script itself > is in a CDATA section. > > --- In [email protected] <flexcoders%40yahoogroups.com>, "Daniel > Freiman" <[EMAIL PROTECTED]> > wrote: > > > > Look at XML.ignoreWhitespace ( > > http://livedocs.adobe.com/flex/201/langref/XML.html). > > > > Also, would think you would be able to create a cdata node by doing > > something like this: > > var cdata:XML = new XML("<![CDATA[" + s + "]]>"); > > > > - Dan Freiman > > > > On 9/7/07, discoguy77 <[EMAIL PROTECTED]> wrote: > > > > > > Hello, > > > I am saving some text from a string into a XML element. > > > For example: > > > > > > var s:String = "Hello "; > > > var xml:XML = <root>{s}</root>; > > > > > > I would like the following to happen: > > > trace(xml); // prints "Hello " (without quotes) > > > > > > Unfortunately, E4X trims the whitespace. I would like my XML > object > > > to be <root><![CDATA[{s}]]></root> so that the space (maybe?) > > > wouldn't be trimmed, but I cannot use a CDATA block since it > occurs > > > inside a <mx:Script><![CDATA[ ... ]]></mx:Script> already. > > > > > > Is there a way to add a CDATA block to an E4X XML object? > > > > > > P.S. As a workaround, I can escape() the string before adding it, > > > and unescape() afterwards, but this seems ugly and loses the > human- > > > readability. > > > > > > > > > > > > > >

