Archive for March, 2008
If you want to serialize an object that contains HTML data in one of its properties, you might want to make sure the HTML ends up in a CDATA section to prevent parsing errors.
Unfortunately, you can’t just put <![CDATA[ and ]]> around your HTML string. Also, the .NET framework does not provide an attribute that tells the serializer to make a string into a CDATA section.
However, you can declare a property of the type XMLCDataSection to get the desired result.