Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Compare Differences crash on CDATA in Javascript



Running CMS 6 R1... I get this error when trying to compare differences between versions:


Cannot have ']]>' inside an XML CDATA block.


   at System.Xml.XmlTextWriter.WriteCData(String text)

   at System.Xml.XmlElement.WriteContentTo(XmlWriter w)

   at System.Xml.XmlElement.WriteTo(XmlWriter w)

   at System.Xml.XmlElement.WriteContentTo(XmlWriter w)

   at System.Xml.XmlElement.WriteTo(XmlWriter w)

   at System.Xml.XmlNode.get_OuterXml()

   at EPiServer.UI.Edit.PageCompare.Core.Providers.PageCompareAlgorithm.RecursiveNodeCompare(XmlNode firstNode, XmlNode secondNode, StringBuilder final)

   at EPiServer.UI.Edit.PageCompare.Core.Providers.PageCompareAlgorithm.GetDiffOfHtml(String html1, String html2)

   at EPiServer.UI.Edit.PageCompare.VisualPageCompare.OnLoad(EventArgs e)

   at System.Web.UI.Control.LoadRecursive()

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I guess the easy way around it is to change the javascripts... But is there maybe a fix available?

Aug 15, 2011 15:07

Here's the banner ad code that contains the CDATA-syntax...

<script type="text/javascript"><!--//--><![CDATA[//><!--
	if (window.adgroupid == undefined) {
		window.adgroupid = Math.round(Math.random() * 1000);
	document.write('<scr'+'ipt type="text/javascript" sr'+'c=";cookie=info;loc=100;target=_blank;grp='+window.adgroupid+';misc='+new Date().getTime()+'"></'+'scri'+'pt>');


Aug 15, 2011 15:10

It is a known bug in CMS 6 R1.

Bug #43920.

Edited, Aug 15, 2011 21:21

Ah ok, thanks Toni. I altered the CDATA comment syntax and got the compare page to load by the way... However it messes up STYLE-elements so @import-statements such as this fails. Is that also a known bug?

EDIT: To clarify this is the resulting code after comparing... There is no CDATA in the original HTML source.

<style media="all" type="text/css"><![CDATA[
	@import '/mycsspath.css';


Edited, Aug 16, 2011 9:27

STYLE-elements with @import-statements seems to be working ok now after upgrading to CMS 6 R2.

Oct 14, 2011 16:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.