0

我正在使用 LibCurl(使用 SSL)从 API 中检索 XML。但它给出了一个错误代码(9),我不知道它代表什么。谁能指出我的解决方案?

代码片段:

    if(success)
    {

        tinyxml2::XMLDocument doc;

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

字符串答案的内容:

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

1 回答 1

1

内容末尾的尾随0使 XML 无效。根据定义,TinyXml 错误 9 是TIXML_ERROR_PARSING_UNKNOWN.

于 2012-05-21T21:29:24.917 回答