Skip to main content

Microsoft Silverlight

Unanswered Question Error when processing XMLRSS Feed

(0)

Jhorra
Jhorra

Member

Member

522 points

475 Posts

Error when processing XML

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
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Re: Error when processing XML

 Are you using DownloadStringAsync or OpenReadAsync method?

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jhorra
Jhorra

Member

Member

522 points

475 Posts

Re: Re: Error when processing XML

I'm using DownloadStringAsync

sladapter
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Re: Re: Error when processing XML

Then what is in the e.Result? Check the e.Result to see if it's complete XML string you expect.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jhorra
Jhorra

Member

Member

522 points

475 Posts

Re: Re: Re: Error when processing XML

The xml is complete when I view e.Result, but it doesn't error out every time either.

sladapter
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Re: Re: Re: Error when processing XML

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.

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Re: Re: Re: Error when processing XML

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?

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

Jhorra
Jhorra

Member

Member

522 points

475 Posts

Re: Re: Re: Re: Error when processing XML

It's the same every time.

sladapter
sladapter

All-Star

All-Star

17441 points

3,172 Posts

Re: Re: Re: Re: Error when processing XML

 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
            }
        } 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities