By "code" do you mean XML markup?
Text other than XML markup can contain characters that might be mistaken
for XML and therefore should be escaped. It may be more convenient
to stick the entire text into a CDATA rather than individually escaping
each character that an XML processor is sensitive to. For example:
<EMAIL-HEADER>
<![CDATA[From: Martin Beet <Martin.Beet@ncl.ac.uk>]]>
</EMAIL-HEADER>
Similarly for more specialized text, such as the native commands of a
speech synthesizer (where I don't have any control over the syntax
accepted by the synthesizer):
<SYNTHCMDS ID="Croaker"><![CDATA[<voice=bullfrog><ribbit=1>]]></SYNTHCMDS>
The CDATA method may be easier to generate programatically and it may
be viewed as more readable than individually escaping characters.
Eric Baatz
Sun Microsystems Laboratories
2 Elizabeth Drive, MS UCHL03-207 (508) 442-0257
Chelmsford, MA 01824 fax: (508) 250-5067
USA Internet: eric.baatz@east.sun.com