Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Error when processing XML
8 replies. Latest Post by sladapter on June 6, 2008.
(0)
Jhorra
Member
522 points
475 Posts
06-06-2008 1:40 PM |
I have a REST API that I call for our wesite, and it's been choking lately on one of the calls telling me the root element is missing. I know for a fact that it is there and suspect the culprit is the length of the XML. Is there a limit to what it can read, or can I do something to make sure it completely downloads the result before it tries to read it?
sladapter
All-Star
17441 points
3,172 Posts
06-06-2008 1:45 PM |
Are you using DownloadStringAsync or OpenReadAsync method?
06-06-2008 2:00 PM |
I'm using DownloadStringAsync
06-06-2008 2:03 PM |
Then what is in the e.Result? Check the e.Result to see if it's complete XML string you expect.
06-06-2008 2:12 PM |
The xml is complete when I view e.Result, but it doesn't error out every time either.
06-06-2008 2:22 PM |
I remember seeing one thread talked about something similar. It's like the reading start before the whole string is received. You can do a search and see if you can find it.
06-06-2008 3:30 PM |
By the way, do every time you have the exact same XML string back? Or they are different? Could it be sometimes the string is too long (exceeding the limit of set in the Web.Config for the WebService call) and get cut off?
06-06-2008 3:42 PM |
It's the same every time.
06-06-2008 4:40 PM |
Can you add an alert and see what is the returning string when you get error:
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null) { HtmlPage.Window.Alert(e.Result); //e.Rresult should be the returning string of your page.
//Then read your XML } }