Yes, CDATA should work.  The following works in Flex:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009";
    xmlns:mx="library://ns.adobe.com/flex/mx">

    <mx:TextArea width="500" height="500">
        <mx:text>
<![CDATA[
"for machine in $(pfexec VBoxManage list runningvms | cut -f 1 -d ' ' | sed
's/&quot;//g'); do pfexec VBoxManage showvminfo $machine | grep
&quot;Memory size:&quot; | sed 's/^.* \([0-9]*\)MB$/\1/g' ; done | awk
'{sum+=$1/1024.0}END{printf &quot;Running:  %d GB\n&quot;, sum}'; for
machine in $({ pfexec VBoxManage list vms | grep -v Template; pfexec
VBoxManage list runningvms; } | sort | uniq -u | cut -f 1 -d ' ' | sed
's/&quot;//g'); do pfexec VBoxManage showvminfo $machine | grep
&quot;Memory size:&quot; | sed 's/^.* \([0-9]*\)MB$/\1/g' ; done | awk
'{sum+=$1/1024.0}END{printf &quot;Other:  %d GB\n&quot;, sum}';"
]]>
        </mx:text>
    </mx:TextArea>
</mx:Application>


The only thing you have to escape in CDATA is "]]>".  (You would replace
it with "]]]]><![CDATA[>".)


I've opened compiler issue #213.  The problem is that it thinks things
like "{sum}" are data binding.  (And newlines are being lost, too, if
you have other text.)



On 5/13/2022 4:08 AM, Piotr Zarzycki wrote:
> Shouldn't CDATA be ignored by compiler ? At least what is inside of it ?
>
> czw., 12 maj 2022 o 17:37 Piotr Zarzycki
> napisaƂ(a):
>
>> Hi guys,
>>
>> I'm fighting with problem of displaying text inside component in MXML. I
>> have following text and a lot of similar one:
>>
>> "for machine in $(pfexec VBoxManage list runningvms | cut -f 1 -d ' ' |
>> sed 's/&quot;//g'); do pfexec VBoxManage showvminfo $machine | grep
>> &quot;Memory size:&quot; | sed 's/^.* \([0-9]*\)MB$/\1/g' ; done | awk
>> '{sum+=$1/1024.0}END{printf &quot;Running:  %d GB\n&quot;, sum}'; for
>> machine in $({ pfexec VBoxManage list vms | grep -v Template; pfexec
>> VBoxManage list runningvms; } | sort | uniq -u | cut -f 1 -d ' ' | sed
>> 's/&quot;//g'); do pfexec VBoxManage showvminfo $machine | grep
>> &quot;Memory size:&quot; | sed 's/^.* \([0-9]*\)MB$/\1/g' ; done | awk
>> '{sum+=$1/1024.0}END{printf &quot;Other:  %d GB\n&quot;, sum}';"
>>
>> I need to literally display it without changes. I would like to do that
>> inside MXML, no var declaration etc. I was experimenting with CDATA, but
>> compiler still complains about some literals inside this text instead
>> ignoring it.
>>
>> Does anyone have an experience with this ?
>>
>> Thanks,
>> --
>>
>> Piotr Zarzycki
>>
>

Reply via email to