0

I'm using LibCurl (with SSL) to retrieve XML from an API. But it gives an errorcode (9), and I don't know where it stands for. Can anyone point me to the solution?

Snippet of code:

    if(success)
    {

        tinyxml2::XMLDocument doc;

        //Parse doc and check returncode
        int returnCode = doc.Parse((const char*)answer.c_str());
        if(returnCode == 0)
        {
          ...

Content of string answer:

answer  "<?xml version="1.0" encoding="utf-8"?><response><retrieval_state>PE</retrieval_state><extension>.wav</extension><created>2012-05-21 16:22:58.080142</created><retrieval_log> </retrieval_log><download_url>https://com-samplesumo-api-production-files.s3.amazonaws.com/22/ff/db/22/22ffdb22-a38b-11e1-8079-fefdb24fa184.wav?Signature=jKjxnXt29atJsE0r%2BMLGvnsm1Cg%3D&amp;Expires=1337636278&amp;AWSAccessKeyId=AKIAJFTECP76EXJQW7EQ</download_url><file_uuid>22ffdb22-a38b-11e1-8079-fefdb24fa184</file_uuid><original_filename>911.wav</original_filename></response>0"    std::basic_string<char,std::char_traits<char>,std::allocator<char> >
Lennart-
  • 519
  • 1
  • 6
  • 19

1 Answers1

1

That trailing 0 at the end of your content makes the XML invalid. According to the definition, TinyXml error 9 is TIXML_ERROR_PARSING_UNKNOWN.

K-ballo
  • 80,396
  • 20
  • 159
  • 169
  • Doh, so stupid :/ It has to be a problem with libcURL using HTTPS, cause over HTTP there wasn't a trailing 0. Thanks for noticing – Lennart- May 21 '12 at 21:34