TinyXml:ErrorCode 9

时间:2012-05-21 21:27:26

标签: c++ tinyxml

我正在使用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> >

1 个答案:

答案 0 :(得分:1)

内容末尾的0跟踪会导致XML无效。根据定义,TinyXml错误9是TIXML_ERROR_PARSING_UNKNOWN