How to: Embed HTML within XML
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 " ] ] >“
Have a second? Check out this great Canadian Health & Living Store based in Toronto


October 4th, 2008 at 4:54 pm
Hi,
Thanks this helped me solve a problem of xsl stripping from the data of a node.
October 4th, 2008 at 4:56 pm
I was saying the xsl was stripping <br /> (html breaks) from the data of a node.
March 9th, 2009 at 2:26 pm
Thank you,
very concise and helpful.