XML error when posting back from menu item:

This post has 19 replies

Not Ranked
Posts: 4
Autodesk-AC Posted: Fri Dec 23, 2005 @ 12:44 PM
ComponentArt.Web.UI version 3.0.1545.0 I am creating a menu programatically in the code behind ... //Create new move item item = new MenuItem(); item.LookId = "CreateItem"; item.ToolTip = "Create Item"; item.Text = "Create"; item.ID = "CREATE"; _requestMenu.Items.Add(item); //delete selected move items item = new MenuItem(); item.LookId="DeleteItem"; item.ToolTip = "Delete selected items"; item.Text = "Delete"; item.ID = "DELETE"; _requestMenu.Items.Add(item); ... and have the ASP.Net code to AutoPostBackOnSelect=true ... ... However once the page renders and I click any one of the menu items I get the following exception: Exception Details: System.Xml.XmlException: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 1, position 675. [XmlException: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 1, position 675.] System.Xml.XmlScanner.ScanLiteral() +351 System.Xml.XmlTextReader.SetLiteralValues(XmlAttributeTokenInfo fld) +132 System.Xml.XmlTextReader.SetAttributeValues() +206 System.Xml.XmlTextReader.ParseElement() +138 System.Xml.XmlTextReader.Read() +94 System.Xml.XmlValidatingReader.ReadNoCollectTextToken() System.Xml.XmlValidatingReader.Read() System.Xml.XmlLoader.LoadChildren(XmlNode parent) +33 System.Xml.XmlLoader.LoadElementNode() +144 System.Xml.XmlLoader.LoadCurrentNode() +38 System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47 System.Xml.XmlLoader.LoadElementNode() +144 System.Xml.XmlLoader.LoadCurrentNode() +38 System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47 System.Xml.XmlLoader.LoadElementNode() +144 System.Xml.XmlLoader.LoadCurrentNode() +38 System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102 System.Xml.XmlDocument.Load(XmlReader reader) +72 System.Xml.XmlDocument.LoadXml(String xml) ComponentArt.Web.UI.GridLevelCollection.LoadXml(String sXml) ComponentArt.Web.UI.Grid.LoadViewState(Object state) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Page.LoadPageViewState() System.Web.UI.Page.ProcessRequestMain() I am not sure what I am missing here and have gone over the code, documentation, and examples many time and still can't see the problem. Any help would be greatly appreciated!
Top 10 Contributor
Posts: 909
breon Posted: Thu Dec 29, 2005 @ 1:33 PM
It seems that an error is occurring while parsing an XML document. While I cannot say for certain what is happening exactly, I'm curious what you are doing on PostBack. How different is it from what's happening during the initial loading of the page?

If you are loading an XML document, please ensure that it is properly formatted.
Breon Halling, Technical Designer
Not Ranked
Posts: 4
Autodesk-AC Posted: Tue Jan 3, 2006 @ 9:02 AM
The page contained a ComponentArt Grid, that apparently was causing the problem when the page was posted back. Once I removed the grid from the page the application was able to successfully post back.

The grid was based on one of the examples.
Not Ranked
Posts: 1
feichu Posted: Mon Feb 6, 2006 @ 9:31 AM
Hi! I have a similar problem when using the latest 2006.1 Beta version.

In a ContentPlaceHolder(using a Master page) page, both a grid and a menu component are contained in its own callback control. Menu items are created dynamically.

<ComponentArt:SplitterPaneContent id="Content1" >
...
<td align="right" width="200px">
<ComponentArt:Callback ID="CallbackMenu" Width="200px" runat=server>
<Content>
<ComponentArt:Menu id="Menu1"
EnableViewState="true"
AutoPostBackOnSelect="true"
runat="server">
</ComponentArt:Menu>
</Content>
</ComponentArt:Callback>
...

<ComponentArt:CallBack ID="CallbackGrid" width="100%" runat="server">
<Content>

<ComponentArt:Grid id="Grid1"
EnableViewState="true"
RunningMode="Client"
EnableTheming="true"
SkinID="GridSkin"
ClientSideOnCheckChanged="Grid1Select"
runat="server">
...

First time when the page is loaded up, the Menu1_ItemSelected event works fine.

However, after a client side java scipt triggers both the callback events above(inside the CallbackMenu_Callback event, some items got enabled or disabled based on certain conditions, and re-rendor itself)

private void CallbackMenu_Callback(object sender, ComponentArt.Web.UI.CallBackEventArgs e)
{
Menu1.FindItemById("miItem1").Enabled = true;
Menu1.FindItemById("miItem2").Enabled = false;

Menu1.RenderControl(e.Output);
}

then clicking on a menu item that previously worked, the following error shows up:

Error loading client properties: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 2842.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at ComponentArt.Web.UI.Menu.LoadClientProperties(String sData)

Any ideas what may cause this problem? Thanks.
Not Ranked
Posts: 7
vlsicpre Posted: Mon Mar 6, 2006 @ 8:56 AM
I had this same problem with a grid but it ended up being caused by some html (hyperlink tags) that I had set in the Header text property of a column.
Not Ranked
Posts: 1
mrajaram Posted: Mon Sep 25, 2006 @ 9:18 AM
I am having this problem with the tab control. I get the error "Error loading client properties" when I am dragging a webpart. Basically, I have the tab control in a web part and if I drag the web part I get this error. Is there any fix for it?
Top 500 Contributor
Posts: 18
TiborCsizmadia Posted: Tue Sep 26, 2006 @ 1:57 AM
Hi,

i have the same Problem with a menu-control.
Message: Allgemeiner Fehler:Error loading client data: System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 19515.

at System.Xml.XmlTextReaderImpl.Throw(Exception e)

at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)

at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Int32 pos, Char invChar)

at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)

at System.Xml.XmlTextReaderImpl.ParseText()

at System.Xml.XmlTextReaderImpl.ParseElementContent()

at System.Xml.XmlTextReaderImpl.Read()

at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)

at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)

at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)

at System.Xml.XmlDocument.Load(XmlReader reader)

at System.Xml.XmlDocument.LoadXml(String xml)

at ComponentArt.Web.UI.BaseNavigator.LoadClientData(String sData)

at ComponentArt.Web.UI.BaseNavigator.LoadClientData(String sData)

at ComponentArt.Web.UI.Menu.LoadViewState(Object savedState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Control.LoadChildViewStateByID(ArrayList childState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

at System.Web.UI.Page.LoadAllState()

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


the problem is, that i found this error message in the log on a live server and i can not say at which situation the user see this error

Thanks for help
Tibor Csizmadia DevWare GmbH
Top 500 Contributor
Posts: 25
walkingboy Posted: Wed Nov 8, 2006 @ 10:49 PM
me too.

if i don't use chinese in menu items,it will work fine.

but,it work fine at 2006.1,don't work other version(2006.2 or 2006.2 beta for ajax with the same code and menu's xml.
Top 500 Contributor
Posts: 25
walkingboy Posted: Fri Nov 10, 2006 @ 3:24 AM
anybody tell me how can i do?

i have submited a online support request yesterday.

but i haven't receive office's reply.

tanks at advance.
Not Ranked
Posts: 5
jingzhao321 Posted: Sat Nov 11, 2006 @ 8:39 PM
I use the C:\Program Files\ComponentArt\Web.UI 2006.2 for ASP.NET 2.0\live_examples\Grid\features\ajax_grid

sample to recreat this problem.

Add the linkbutton to the form

<form id="Form1" method="post" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="webform1.aspx">LinkButton</asp:LinkButton>


The program works fine in IE 6.0. In IE 5.0 which comes with window 2000, you will get.

Error loading postback data: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at ComponentArt.Web.UI.Grid.LoadClientData(String sData)


The error does not occur in 2006.1 as the button does not work at all.

We need this problem fixed as soon as possible.

Thank you
Not Ranked
Posts: 5
jingzhao321 Posted: Sat Nov 11, 2006 @ 8:48 PM
Run the sample in IE 5.0

http://localhost/ComponentArt.Web.UI.2006.2.fw2.Standard_Examples/grid/features/ajax_grid/WebForm1.aspx

click the next page button, you will get the same error.
Not Ranked
Posts: 5
jingzhao321 Posted: Sat Nov 11, 2006 @ 8:52 PM
This is some information I found. Hope this will help to fix this problem.


XmlException: The data at the root level is invalid. Line 1, position 1.
This might be a really obscure (or dumb?) ASP.NET / C# problem, but again I thought I'd post something about it in case it helps someone else searching about this issue....

I was getting an exception when loading an XML file:

Error with ... xml\nav.xml: System.Xml.XmlException:
The data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReader.ParseRoot()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlValidatingReader.ReadWithCollectTextToken()
at System.Xml.XmlValidatingReader.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
Using the following code:

docXml.LoadXml(xml);Searching for others' advice / solutions for such a problem on the web didn't help very much... it kept happening no matter what I was trying.

Turned out the problem was very very simple to fix (as they sometimes are) - it was just a typo. The variable "xml" was a full file path to an xml FILE I was trying to load, and silly me, you have to use docXml.Load() to load an xml FILE, not docXml.LoadXml() - the typo must have gotten in there from a poor use of VS.NET Intellisense or something (auto-completing LoadXml instead of just Load) - doh!

Changing the code to:

docXml.Load(xml);Worked just fine (of course).

Like I mentioned, just in case this helps someone else!
Top 500 Contributor
Posts: 25
walkingboy Posted: Sun Nov 12, 2006 @ 5:00 PM
I have recieved a office's reply.
he said
"This is a known issue with this release, I'm afraid, but it has been
fixed for the upcoming service release. I don't have a date for you
right now, but you might want to check late next week. "

i think we have to waiting and waiting...
Not Ranked
Posts: 6
zakiyama01 Posted: Tue Nov 21, 2006 @ 12:32 AM
hi,
I tested a similar problem when using the ASP.NET 2.0-2006.2.1477.2.
It seems XML error of everything excluding alphabet or number.

In a TabStrip , TreeView and Menu ,..etc.

It seems that the entire Xml is done HtmlDecode in LoadViewState.
Not Ranked
Posts: 1
zhaowenzheng Posted: Wed Nov 22, 2006 @ 6:35 AM
yes,i have the save problem when using 2006.2.1477.2

it's work well when using 2006.1
Page 1 of 2 (20 items) 1 2 Next >