Character data (also known as CDATA) is a special form of textual data. In HTML and XML, it is used both for attribute values and as textual content of elements. User agents process text in the form of character data in the following way:
- Character entities are replaced with their corresponding characters.
- Carriage returns and tab characters are each replaced with a single space.
- Leading and trailing white space may be ignored (decision is up to the user agent).
For example, the CDATA
twee drie" is interpreted as
"één twee drie".
Script and style content
Even thought the HTML 4 specification defines
<style> content as CDATA, it really is treated as raw text, meaning that white space and character entities are maintained as they are. The first occurrence of the sequence
</ is treated as the end of the content.