all groups > dotnet xml > may 2005 >
You're in the

dotnet xml

group:

XML Serialization and CDATA


XML Serialization and CDATA John Pouliezos
5/26/2005 12:00:00 AM
dotnet xml:
Hi...

I am trying to Serialize a class using XmlSerializer. The problem is, I
have a property in which I store HTML data, and I want to include id in
the XML as a CDATA node. Any suggestions?

Re: XML Serialization and CDATA Oleg Tkachenko [MVP]
6/1/2005 12:00:00 AM
[quoted text, click to view]

The easiest way is to pass resulting XML via the following XSLT:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output cdata-section-elements="foo"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

--
Oleg Tkachenko [XML MVP, MCAD]
AddThis Social Bookmark Button