purpose CDATA sections

Eric Baatz - Sun Microsystems Labs BOS ebaatz at barbaresco.East.Sun.COM
Fri Aug 15 17:16:56 BST 1997

>  The only purpose of the CDATA section (CDSect) I can think of is for
>  showing code examples. Am I missing something?

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:

<![CDATA[From: Martin Beet <Martin.Beet at ncl.ac.uk>]]>

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 at east.sun.com

xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa at ic.ac.uk)

More information about the Xml-dev mailing list