I spent some time today trying to figure out how to embed HTML within XML. This would obviously be an issue. When the XML would be parsed, the parser would easily mistaken the HTML tags as child XML tags.
I thought using urencode() or perhaps replacing all ‘<' and '>‘ with < and >. Then it hit me, the XML standard should have thought about this. So I checked the XML 1.0 standard. They did have a solution (remove spaces):
CDATA sections begin with the string ” < ! [C D A T A [ " and end with the string " ] ] >“