13. CDATA

CDATA stands for character data. This technically is an entity which tells the parser that a stream of characters is to follow until it reaches its end tag. I have used this entity quite a bit in the writing of this document. The advantage of using this is that the parser ignores all tags within the CDATA "container". Here's what it looks like:

<![ CDATA [
This text will not <be> parsed no matter <what> I put in <here>.  Even if I put <illegal>
tags!
]]>

Usually, this is used inside a <programlisting> or <screen> tag because program code or user input on a screen many times contains characters which may confuse the parser. Here's what the above looks like formatted within a <screen>:

This text will not <be> parsed no matter <what> I put in <here>.  Even if I put <illegal>
tags!

And here's what it looks like when it is "inline":

This text will not <be> parsed no matter <what> I put in <here>. Even if I put <illegal> tags!

The key here is to note that the entity begins with "<![". Then the CDATA entity is given. Then the first "container" marker for the CDATA is "[". You then input the text you want treated as text only (i.e. don't parse it). You close the "container" with "]]>".