Character Entities & CDATA

Special characters that have meaning in XML markup must be escaped in text content and attribute values. CDATA sections provide an alternative escape mechanism for blocks of text with many special characters.

Syntax

xml-fundamentals
&   — & (ampersand)
&lt;    — < (less than)
&gt;    — > (greater than)
&quot;  — " (double quote)
&apos;  — ' (apostrophe)
&#NNNN; — Unicode decimal
&#xHHHH; — Unicode hex
<![CDATA[ ... ]]> — escape block

Example

xml-fundamentals
<description>AT&amp;T sells widgets &lt; $10</description>

<code><![CDATA[
  if (a < b && b > 0) {
    console.log("AT&T wins!");
  }
]]></code>