By definition, CDATA section content is taken as such, not parsed even for character references like &#153;. See What does <![CDATA[]]> in XML mean?

Independently of this, &#153; is undefined, though commonly interpreted by browsers as denoting the trade mark character. Correct references for trade mark character are &#8482; and &#x2122;.

If the document encoding is UTF-8, you should enter the character “” as such. Inside CDATA sections, it’s really the only way.

Answer from Jukka K. Korpela on Stack Overflow
🌐
TutorialsPoint
tutorialspoint.com › xml › xml_cdata_sections.htm
XML - CDATA Sections
This section may contain markup characters (<, >, and &), but they are ignored by the XML processor. The following markup code shows an example of CDATA. Here, each character written inside the CDATA section is ignored by the parser. <script> <![CDATA[ <message> Welcome to TutorialsPoint </message> ]] > </script > In the above syntax, everything between <message> and </message> is treated as character data and not as markup. The given rules are required to be followed for XML CDATA −
🌐
University of Bologna
lia.deis.unibo.it › Courses › TecnologieWeb0708 › materiale › laboratorio › guide › j2ee14tutorial7 › JAXPSAX6.html
Displaying Special Characters and CDATA
A CDATA section works like <pre>...</pre> in HTML, only more so: all whitespace in a CDATA section is significant, and characters in it are not interpreted as XML. A CDATA section starts with <![CDATA[ and ends with ]]>. The file slideSample04.xml contains this CDATA section for a fictitious technical slide:
Top answer
1 of 13
1263

CDATA stands for Character Data and it means that the data in between these strings includes data that could be interpreted as XML markup, but should not be.

The key differences between CDATA and comments are:

  • As Richard points out, CDATA is still part of the document, while a comment is not.
  • In CDATA you cannot include the string ]]> (CDEnd), while in a comment -- is invalid.
  • Parameter Entity references are not recognized inside of comments.

This means given these four snippets of XML from one well-formed document:

<!ENTITY MyParamEntity "Has been expanded">

<!--
Within this comment I can use ]]>
and other reserved characters like <
&, ', and ", but %MyParamEntity; will not be expanded
(if I retrieve the text of this node it will contain
%MyParamEntity; and not "Has been expanded")
and I can't place two dashes next to each other.
-->

<![CDATA[
Within this Character Data block I can
use double dashes as much as I want (along with <, &, ', and ")
*and* %MyParamEntity; will be expanded to the text
"Has been expanded" ... however, I can't use
the CEND sequence. If I need to use CEND I must escape one of the
brackets or the greater-than sign using concatenated CDATA sections.
]]>

<description>An example of escaped CENDs</description>
<!-- This text contains a CEND ]]> -->
<!-- In this first case we put the ]] at the end of the first CDATA block
     and the > in the second CDATA block -->
<data><![CDATA[This text contains a CEND ]]]]><![CDATA[>]]></data>
<!-- In this second case we put a ] at the end of the first CDATA block
     and the ]> in the second CDATA block -->
<alternative><![CDATA[This text contains a CEND ]]]><![CDATA[]>]]></alternative>
2 of 13
377

A CDATA section is "a section of element content that is marked for the parser to interpret as only character data, not markup."

Syntactically, it behaves similarly to a comment:

<exampleOfAComment>
<!--
    Since this is a comment
    I can use all sorts of reserved characters
    like > < " and &
    or write things like
    <foo></bar>
    but my document is still well-formed!
-->
</exampleOfAComment>

... but it is still part of the document:

<exampleOfACDATA>
<![CDATA[
    Since this is a CDATA section
    I can use all sorts of reserved characters
    like > < " and &
    or write things like
    <foo></bar>
    but my document is still well formed!
]]>
</exampleOfACDATA>

Try saving the following as a .xhtml file (not .html) and open it using FireFox (not Internet Explorer) to see the difference between the comment and the CDATA section; the comment won't appear when you look at the document in a browser, while the CDATA section will:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
<head>
<title>CDATA Example</title>
</head>
<body>

<h2>Using a Comment</h2>
<div id="commentExample">
<!--
You won't see this in the document
and can use reserved characters like
< > & "
-->
</div>

<h2>Using a CDATA Section</h2>
<div id="cdataExample">
<![CDATA[
You will see this in the document
and can use reserved characters like
< > & "
]]>
</div>

</body>
</html>

Something to take note of with CDATA sections is that they have no encoding, so there's no way to include the string ]]> in them. Any character data which contains ]]> will have to - as far as I know - be a text node instead. Likewise, from a DOM manipulation perspective you can't create a CDATA section which includes ]]>:

var myEl = xmlDoc.getElementById("cdata-wrapper");
myEl.appendChild(xmlDoc.createCDATASection("This section cannot contain ]]>"));

This DOM manipulation code will either throw an exception (in Firefox) or result in a poorly structured XML document: http://jsfiddle.net/9NNHA/

🌐
O'Reilly
oreilly.com › library › view › xml-in-a › 0596007647 › re06.html
CDATA (Character Data) Sections - XML in a Nutshell, 3rd Edition [Book]
September 23, 2004 - Within a CDATA block, every character between the opening and closing strings is treated as character data. Thus, special characters can be included in a CDATA section with impunity, except for the CDATA closing sequence, ]]>.
Authors   Elliotte Rusty HaroldW. Scott Means
Published   2004
Pages   712
🌐
Try Harder
xuki.dev › posts › xml cdata complete guide: how to handle special characters in xml
XML CDATA Complete Guide: How to Handle Special Characters in XML | Try Harder
December 31, 2025 - Learn when to use CDATA vs escaping, security best practices, and real-world applications for JavaScript, CSS, and HTML embedding. CDATA (Character Data) creates safe zones in XML where special characters like <, >, and & can appear without escaping.
🌐
Wikipedia
en.wikipedia.org › wiki › CDATA
CDATA - Wikipedia
January 13, 2026 - When the XML document is converted to a more limited character set, such as ASCII, characters that can no longer be represented are converted to &#nnn; character references for a lossless conversion. But within a CDATA section, these characters can not be represented at all, and have to be removed or converted to some equivalent, altering the content of the CDATA section.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › xml tutorial › xml cdata
XML CDATA | How CDATA works in XML with Examples
April 5, 2023 - ... In the above syntax the first ... wrapping up with the CDATA tag, the characters in the code sections are treated as only text not as mark-up which may also include special characters....
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › html › xml-cdata-sections
XML - CDATA Sections - GeeksforGeeks
July 23, 2025 - These sections include blocks of ... that would normally have special meaning in XML, such as < (less than sign) > (greater than sign) and & (ampersand)....
🌐
Devzery
devzery.com › post › cdata-in-xml-a-comprehensive-guide-for-developers
CDATA in XML: A Comprehensive Guide for Developers
August 28, 2024 - Non-Parsed: Content inside a CDATA section is not parsed as XML, which means it is not subject to validation or interpretation by the XML parser. Escape-Free: You do not need to escape special characters like <, >, and & within a CDATA section, ...
🌐
W3Resource
w3resource.com › xml › CDATA-sections.php
XML CDATA - w3resource
A CDATA section begins with the character sequence <![CDATA[ and ends with the character sequence ]]>. Between the two character sequences, an XML processor ignores all markup characters such as <, >, and &. The only markup an XML pro-cessor ...
🌐
Coddy Reference
ref.coddy.tech › home › xml › xml cdata sections
XML CDATA Sections | Coddy Reference
4 days ago - CDATA, which stands for Character Data, is a mechanism in XML that allows you to include text that might contain characters that would otherwise be interpreted as markup. This is particularly useful when dealing with content that includes a ...
🌐
Quackit
quackit.com › xml › tutorial › xml_cdata.cfm
XML CDATA
Many progamming scripts contain characters such as less than/greater than signs, ampersands etc, which would cause problems for the XML processor. CDATA allows you to escape the whole block of text. This eliminates the need to go through the whole script, individually replacing all the potentially ...
🌐
Coderanch
coderanch.com › t › 599171 › languages › Special-character-CDATA
Special character in CDATA (XML forum at Coderanch)
November 30, 2012 - this forum made possible by our volunteer staff, including ... ... I'm trying to render a trademark symbol within this CDATA tag within an XML document ( I'm using: <?xml version="1.0" encoding="UTF-8"?> ) <head><![CDATA[Product name ™]]> </head> It just gets rendered as Product name ™ Any help greatly appreciated!
🌐
EDUCBA
educba.com › home › software development › software development tutorials › xml tutorial › xml reserved characters
XML reserved characters | How to use reserved characters in XML?
April 5, 2023 - XML reserved Characters are defined as special characters that are used in the CDATA section. XML processors parse these reserved characters since XML uses tree-like structures of tags and representing entities in a challenging task.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Novixys Software
novixys.com › blog › what-characters-need-to-be-escaped-in-xml-documents
What Characters Need to be Escaped in XML Documents? | Novixys Software Dev Blog
January 2, 2017 - This section begin with the string “<![CDATA[” and end with the string “]]>”. Within a CData section, none of the 5 special characters must be encoded. <valid><![CDATA[[<greeting>Hello world: <>&'" </greeting>]]></valid> However, within ...
🌐
Datacadamia
datacadamia.com › markup › xml › cdata
XML - Character data (CDATA) - Escape
August 30, 2024 - All text that is not markup or comment constitutes the character data of the document (known as CDATA). CDATAPCDATAchild If you want to embedded reserved characters xml character in your docu ...
🌐
ReqBin
reqbin.com › xml › 4qqicnq8 › xml-cdata-example
What is the CDATA in XML?
June 11, 2022 - CDATA (meaning character data) is used for different but related purposes in the SGML and XML markup languages. The term CDATA is used for textual data that should not be parsed by an XML parser. The characters "<" and "&" are not allowed within ...