XML Export issue

Apr 3, 2009 at 10:40 PM
Edited Apr 3, 2009 at 10:42 PM
I'm getting an issue exporting the website, not sure if you can help (@cristian). This is all I'm getting back:

Exception Details: System.InvalidOperationException: Token EndElement in state Error would result in an invalid XML document.
[InvalidOperationException: Token EndElement in state Error would result in an invalid XML document.]   System.Xml.XmlTextWriter.AutoComplete(Token token) +3962798   System.Xml.XmlTextWriter.InternalWriteEndElement(Boolean longFormat) +405   System.Xml.XmlTextWriter.WriteEndElement() +6   N2.Serialization.ElementWriter.Dispose() +12   N2.Serialization.Exporter.Export(ContentItem item, ExportOptions options, TextWriter output) +350   N2.Serialization.Exporter.Export(ContentItem item, ExportOptions options, HttpResponse response) +125   N2.Edit.Export.Default.btnExport_Command(Object sender, CommandEventArgs e) +124   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +108   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Apr 4, 2009 at 10:22 AM
Could you narrow the behaviour down to a specific type of item and/or content? Hard to tell from the stack trace alone.
Apr 4, 2009 at 2:23 PM
I tracked down the culprit page:

If you scroll down you can see the page has its own XML in it (stored as < > not &lt; and &gt;) and the main problem is the CDATA chunk. The exception is throwing on ElementWriter:

public void WriteCData(string value)

One answer might be to base64 the Strings incase the Detail has invalid XML in it? Although I would've thought the XMLWriter was smart enough to encode entities
Apr 5, 2009 at 9:19 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.