9

Possible Duplicate:
what is the meaning of CDATA

What is, and when is used the ![CDATA[ string/variable/constant? (I don't know what is it)

Community
  • 1
  • 1
ibito
  • 161
  • 2
  • 8

4 Answers4

13

It is a way to escape large sections of text in XML documents.

From wikipedia:

In an XML document or external parsed entity, a CDATA section is a section of element content that is marked for the parser to interpret as only character data, not markup.

By the way, it is <![CDATA[]]>, not ![CDATA[]].

Oded
  • 489,969
  • 99
  • 883
  • 1,009
2

The term CDATA ((Unparsed) Character Data) is used about text data that should not be parsed by the XML parser.

Some text, like JavaScript code, contains a lot of "<" or "&" characters. To avoid errors script code can be defined as CDATA.

Ref

Jahan Zinedine
  • 14,616
  • 5
  • 46
  • 70
2

CDATA is used in XML (and hence XHTML) to insert text which might include "special" characters (eg. < and >) which would normally break the XML parser (and to be fair, confuse a human reader, as well!).

For example, you could use it to embed a code segment inside an XML document.

winwaed
  • 7,645
  • 6
  • 36
  • 81
-1

It is used in XML, inside can be everything.

Ency
  • 633
  • 5
  • 16