When generating RSS feeds, the RSS standard says that these translations have to be made for content to not be interpreted as XML, but rather as plaintext:
'&' => '&'
'<' => '<'
'>' => '>'
And that's precisely what I do. No problems.
However, it also supports a <![CDATA[ ... ]]>
syntax, described here: https://en.wikipedia.org/wiki/CDATA
Using CDATA blocks is just like the first way, except it's horribly broken: it cannot contain ]]>` anywhere inside, because that ends the CDATA block!
This means that you have to make very confusing little "hacks" to be able to nest CDATA blocks, and since we are outputting a RSS document with a bunch of random content, it can obviously very well contain ]]>
somewhere, so then you have to apply an escape routine for anything you put inside a "CDATA block".
So, with this in mind, why would anyone ever want to use CDATA blocks instead of escaping those three XML/RSS specials characters as the standard defines? I don't understand.
The only guess I have is that, if you have tons of content, then the number of bytes could grow sizeable if you have a bunch of <
stuff everywhere, compared to just a CDATA start/end tag with plain characters inside...
So maybe I answered my own question right away, but is the only reason to "save some bytes of network traffic"? The part where you have to escape internal CDATA end tags puts me off from using CDATA blocks.