XML
CDATA Sections
Escape blocks of literal text.
By EZ4Code Team
cdataescaping
Code
<?xml version="1.0"?>
<content>
<code><![CDATA[
if (x < 5 && y > 3) {
console.log("<not a tag>");
}
]]></code>
<text>Normal text uses & < > for escaping</text>
</content>Explanation
A CDATA section tells the parser to treat its contents as raw characters, ignoring markup so <, >, and & need no escaping. It is useful for embedding code or HTML inside XML without doubling every ampersand. CDATA cannot contain the sequence ]]> and cannot be nested.