In some cases you need to nest a CDATA inside another CDATA like when you use a ContentEditorWebPart in the ONET.XML by creating a template definition. A CDATA is used to let the parser skip the information found between the brackets in case you don't want that part to be parsed.
For example:
<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
<![CDATA[
<WebPart xmlns:xsd="" xmlns:xsi="" xmlns="">
<Title>Title</Title>
<Assembly>Microsoft.SharePoint, ...</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<ContentLink xmlns="" />
<Content xmlns="">
<html><b>Hello there</b></html>
</Content>
</WebPart>
]]>
</AllUsersWebPart>
This example will fail because it tries to parse the html inside the <Content> tag. So you could do the following:
<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
<![CDATA[
<WebPart xmlns:xsd="" xmlns:xsi="" xmlns="">
<Title>Title</Title>
<Assembly>Microsoft.SharePoint, ...</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<ContentLink xmlns="" />
<Content xmlns="">
<!CDATA[
<html><b>Hello there</b></html>
]]>
</Content>
</WebPart>
]]>
</AllUsersWebPart>
Also this is not gonna work. The parser actually thinks that the part it should not parse stops at the first ]]> found. The solution is relative simple but in some cases it can be time consuming.
<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
<![CDATA[
<WebPart xmlns:xsd="" xmlns:xsi="" xmlns="">
<Title>Title</Title>
<Assembly>Microsoft.SharePoint, ...</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<ContentLink xmlns="" />
<Content xmlns="">
<html><b>Hello there</b></html>
</Content>
</WebPart>
]]>
</AllUsersWebPart>
By rewriting characters that cause the parser to think that it is xml will solve your problem. That means that the sign < will be < and the sign > will be >
The following sources are available on the internet:
http://www.peej.co.uk/articles/cdata
http://xml.silmaril.ie/authors/cdata/
http://weblogs.asp.net/bsimser/archive/2005/03/29/396135.aspx
http://www.dpawson.co.uk/xsl/sect2/cdata.html