Senior Director &National Competency Lead – Sitecore Commerce
XmlException while using Rendering Parameters
August 03rd, 2016
Rendering parameters gives us an option to add parameters to the Sitecore Presentation Components. While working for one of our clients, we noticed that the Experience Editor throws a System.Xml.XmlException everytime we try to make a change under Presentation Details (where one of the components use rendering parameters). This blog outlines the solution we had to use in order to address it.
This functionality works as expected in the Content Editor and breaks only in the Experience Editor. This issue was experienced in Sitecore 8.1 Update 3.
- Go to Experience Editor
- Make a changes to one of components under Presentation > Details
- Click OK
- Notice that an error occurred
.The exception message looks similar to the attached snippet below.
ERROR '=' is an unexpected token. The expected token is ';'. Line 5, position 92. Exception: System.Xml.XmlException Message: '=' is an unexpected token. The expected token is ';'. Line 5, position 92. Source: System.Xml at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos) at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options) at Sitecore.Shell.Applications.Dialogs.LayoutDetails.LayoutDetailsDialogResult.Parse(String result) at Sitecore.ExperienceEditor.Speak.Ribbon.Requests.LayoutDetails.SetLayoutDetailsRequest.ProcessRequest() at Sitecore.ExperienceEditor.Speak.Server.Requests.PipelineProcessorRequest`1.Process(RequestArgs requestArgs)
I have decompiled and noticed that the issue is happening as part of SetLayoutDetailsRequest SPEAK request located under Sitecore.ExperienceEditor.Speak.Requests.config.
<request name="ExperienceEditor.LayoutDetails.SetValue" type="Sitecore.ExperienceEditor.Speak.Ribbon.Requests.LayoutDetails.SetLayoutDetailsRequest, Sitecore.ExperienceEditor.Speak.Ribbon"></request>
Thanks to Sitecore Support Team who have recorded this as a bug in Sitecore Experience Editor and provided us the solution.
Please perform the following steps to resolve the issue:
Add the attached dll into the /bin directory and the config file should be added under /App_Config/Include.
This patch has been applied and tested on Sitecore 8.1 Update-3
As always, please test these changes on your development environment before applying it on Production.