purpose CDATA sections

David Megginson (ak117@freenet.carleton.ca)
Fri, 15 Aug 1997 11:07:40 -0400


Martin Beet writes:

> I'm in the process of writing (yet) an(other) introduction to XML and
> I'm currently plodding through the standard.
>
> The only purpose of the CDATA section (CDSect) I can think of is for
> showing code examples. Am I missing something?

That's the general idea, but it's a little narrow. Here are a few
uses of CDATA marked sections, off the top of my head:

- source code
- excerpts from system log files
- user sessions with a shell (like bash or command.com)
- sample XML markup
- ASCII art
- mathematical text and other special notations (such as embedded TeX)

Here's a non-source-code example:

<caution>
<para>If the teletype machine displays the following text, please
leave the building as quickly as possible:</para>
<output><![CDATA
------------------------------------------------------------------------
Earthquake Warning
------------------------------------------------------------------------
]]></output>
</caution>

Good luck with the introduction,

David

-- 
David Megginson                 ak117@freenet.carleton.ca
Microstar Software Ltd.         dmeggins@microstar.com
      http://home.sprynet.com/sprynet/dmeggins/