I often find this strange CDATA
tag in XML
files:
I have observed that this CD
Note that the CDATA
construct is only needed if placing text directly in the XML text file.
That is, you only need to use CDATA
if hand typing or programmatically building the XML text directly.
Any text entered using a DOM processor API or SimpleXML will be automatically escaped to prevent running foul of XML content rules.
Notwithstanding that, there can be times where using CDATA
can reduce the text size that would otherwise be produced with all entities encoded, such as for css in style
tags or javascript in script
tags, where many language constructs use characters in HTML|XML, like <
and >
.