A cdata section 1) delimits a text as being cdata (character data). It's used mostly to be able to use (ie escape) reserved xml characters that would otherwise be recognized as xml markup.
An example of a CDATA section, in which
andare recognized as character data, not xml markup:
<![CDATA[<greeting>Hello, world!</greeting>]]>
CDATA works only in strict XML language, therefore, if you want your document to be correctly parsed :
you have the following solutions:
You can encode the reserved character with an HTML entity.
For instance, the above example would become:
<greeting>Hello, world!</greeting>
where every reserved character was transformed as an entity. For instance, the less than character was encoded as <.
The above entity syntax is then rendered correctly in HTML as seen below:
A common solution is to comment out, the CDATA delimiters symbols.
For instance:
<script>
//<![CDATA[
document.write("< is greater than >");
//]]>
</script>
<style type="text/css">
/*<![CDATA[*/
body { background-image: url("illustration.png?width=1200&height=600") }
/*]]>*/
</style>
CDATA sections:
CDATA sections may occur anywhere character data may occur.