12

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
  • 191
  • 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
  • 477,625
  • 97
  • 867
  • 998
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,357
  • 5
  • 42
  • 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,515
  • 6
  • 33
  • 78
0

It is used in XML, inside can be everything.

Ency
  • 605
  • 5
  • 16