VENDITE: 1-800-867-1389

 none
XML parsing error of SQL Azure Server API's response

    Domanda

  • Hi all,

    I wrote some codes to connect SQL Azure Management APIs, connection is ready.

    When I download data from  "ListServers" (https://management.database.windows.net:8443/<subscription-id>/servers), I got an error from XML parser:

    "Data at root level is invalid, Line 1, position 1"

    This issue is just occurred by parsing the data directly with XmlDocument.LoadXml(),it's ok when I put content to XML file and parsing data from XML file.

    Another Windows Azure Management API has not this issue.

    How can I resolve this issue for paring data directly?

    Thanks.


    小朱的技術隨手寫:http://www.dotblogs.com.tw/regionbbs/
    雲端學堂Facebook: http://www.facebook.com/studyazure
    giovedì 25 agosto 2011 05:05

Risposte

  • Workaround:

    Save XML response to temporary file (use Path.GetTempFileName() and FileStream), and read content from temporary file, this issue can be fixed.


    小朱的技術隨手寫:http://www.dotblogs.com.tw/regionbbs/
    雲端學堂Facebook: http://www.facebook.com/studyazure

    • Contrassegnato come risposta 小朱MVP sabato 27 agosto 2011 03:13
    sabato 27 agosto 2011 03:12

Tutte le risposte

  • Do you need to use XmlDocument, or could you use XDocument instead? I successfully used the latter to load the XML directly from the response stream as described in this post.
    giovedì 25 agosto 2011 05:49
    Moderatore
  • Thanks for you answer.

    But, I want to keep the framework compatibility (some clients or customers have .NET Framework 2.0 only), so I can't use LINQ to XML.


    小朱的技術隨手寫:http://www.dotblogs.com.tw/regionbbs/
    雲端學堂Facebook: http://www.facebook.com/studyazure
    giovedì 25 agosto 2011 05:53
  • Workaround:

    Save XML response to temporary file (use Path.GetTempFileName() and FileStream), and read content from temporary file, this issue can be fixed.


    小朱的技術隨手寫:http://www.dotblogs.com.tw/regionbbs/
    雲端學堂Facebook: http://www.facebook.com/studyazure

    • Contrassegnato come risposta 小朱MVP sabato 27 agosto 2011 03:13
    sabato 27 agosto 2011 03:12