Monday, February 9, 2009

CDATA

CDATA in XML is used for placing scripts and some special data, so xml parser will not parse the contents inside the cdata.
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. A CDATA section is merely an alternative syntax for expressing character data; there is no semantic difference between character data that manifests as a CDATA section and character data that manifests as in the usual syntax in which "<" and "&" would be represented by "<" and "&", respectively.
[edit]Syntax and interpretation
A CDATA section starts with the following sequence:
and ends with the first occurrence of the sequence:
]]>
All characters enclosed between these two sequences are interpreted as characters, not markup or entity references. For example, in a line like this:
John Smith
the opening and closing "sender" tags are interpreted as markup. However, if written like this:
John Smith]]>
then the code is interpreted the same as if it had been written like this:
<sender>John Smith</sender>
That is, the "sender" tags will have exactly the same status as the "John Smith"— they will be treated as text.
Similarly, if the numeric character reference ð appears in element content, it will be interpreted as the single Unicode character 00F0 (small letter eth). But if the same appears in a CDATA section, it will be parsed as six characters: ampersand, hash mark, digit 2, digit 4, digit 0, semicolon.



0 comments:

About Me

Bhargavi Moorthy
View my complete profile

FEEDJIT Live Traffic Feed