CDATA Sections

As you know, XML processors are very sensitive to characters such as < and &. So what if you had a large section of text that contained a great many < and & characters that you didn't want to interpret as markup? You can escape those characters as &lt; and &amp;, of course, but with many such characters, that's awkward and hard to read. Instead, you can use a CDATA section.

CDATA sections hold character data that is supposed to remain unparsed by the XML processor. This is a useful asset to XML because otherwise all the text in an XML document is parsed and searched for characters such as < and &. You use CDATA sections simply to tell the XML processor to leave the enclosed text alone and to pass it on unchanged to the underlying ...

Get Inside XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.