2 Replies Latest reply on Sep 6, 2007 10:28 AM by Jacob_B.

    Wrap CDATA in XML and Encoding

    Jacob_B.
      I have TextInput fields that can potentially accept invalid XML content such as &, > , <, etc.. I am binding the TextInput fields to a XML reference object. Is it possible to wrap an element's data within CDATA in flex? The following is what I am attempting (notice the department element):
      -----------------
      <mx:XML id="myEmployee" format="e4x">
      <employee>
      <name>
      <first>{firstName.text}</first>
      <last>{lastName.text}</last>
      </name>
      <department><![CDATA[{department.text}]]></department>
      <email>{email.text}</email>
      </employee>
      </mx:XML>
      -----------------
      When I perform a toString or even a toXMLString on the myEmployee object it comes back as (notice the department element contains escaped characters):
      -----------------
      <employee>
      <name>
      <first>dfd</first>
      <last></last>
      </name>
      <department>dfdf#&amp;</department>
      <email>d@d.com</email>
      </employee>
      -----------------
      I do not want characters to be escaped, I would like it if the characters were retained within a CDATA block. Does anyone know of a solution?

      Thanks!