0

Updated

Please ignore this issue, I was completely misconceived, the issue had nothing to do with what I thought it was, but is rather due to the fact that Composite treats all it's html that it renders from functions as XML, therefore you have to escape certain characters (here is a handy reference: http://www.faqs.org/docs/htmltut/characterentities_famsupp_69.html). In my case I had to replace & with &.

Hope this info helps someone else.

Also, here is a great post on how to escape your strings: String escape into XML

My old misconceived issue:

I have a View which fails to render by the MvcPlayer function of Composite. Through a process of elimination I was able to track it down to the following line in the View:

Url.Action("Action", "Controller", new { Page = 123, PageSize = 180 });

I then went further and discovered that if I changed it to the following:

Url.Action("Action", "Controller", new { PageSize = 180 });

The page then renders with no issues.

I checked the Composite error log, which stated:

System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 81, position 63.
  at System.Xml.XmlTextReaderImpl.Throw(Exception e)
  at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
  at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2)
  at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(Int32 pos, String expectedToken1, String expectedToken2)
  at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(Int32 pos, String expectedToken)
  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.XmlTextReaderImpl.Read()
  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 System.Xml.Linq.XDocument.Parse(String text)
  at Composite.AspNet.MvcPlayer.Functions.RenderInternal(String path) in c:\***************\MvcPlayer\Player.cs:line 125

I know in Composite you reference pages within the system like so:

<a href="/page(@aPage.Data.Id)">Page</a>

The output of my Url.Action is /Controller/Action?Page=123&Page=180

So I assume that composite is picking up on the "?Page=123" part of the URL result from the Action and then is trying to process it as a composite Page reference, which of course it isn't.

Does anyone know how I could get around this issue?

Community
  • 1
  • 1
ctrlplusb
  • 12,847
  • 6
  • 55
  • 57

0 Answers0