XmlSerializer and Mark-up (Xml or Html)
- by Kieron
Hi,
I've a requirement to serialize any class provided (decorated with the appropriate XmlElement/ XmlAttribute etc), but some of the properties may contain some sort of mark-up...usually HTML, but it could as easily be XML in the future.
When trying to serialize the class the XmlSerializer crashes.
I'd hope to be able to apply no more than an attribute to the property (currently set to XmlText) in the hope that it would wrap the content in CDATA[...], but that doesn't seem to work.
I've seen several 'workarounds' like the one here, but I'd hoped for something a little less impactful for the developing consumer.
Does anyone know of any 'nicer' less invasive solution...?
Thanks,
Kieron