makeXMLCData

makeXMLCData(): String;

The makeXMLCData method of the String primitive type returns a new string of the receiver prepended with <![CDATA[and appended with ]]>. Note that the receiver is not modified in any way.

The following example is a receiver string.

<greeting>Hello, world!</greeting>

The returned string of this receiver string is as follows.

<![CDATA[<greeting>Hello, world!</greeting>]]>

Call this method for any string for which you do not want the framework to interpret the XML special characters (that is, <, >, &, and ").