简体   繁体   English

RapidXML异常

[英]RapidXML Exception

I'm trying to parse a response from another system that is in XML. 我正在尝试解析另一个XML系统的响应。 I decided to use RapidXML as my parser. 我决定使用RapidXML作为我的解析器。 Everything was going fine until the system reported a "faultResponse" message. 在系统报告“faultResponse”消息之前,一切都很顺利。 When trying to handle the "faultResponse" message I get a parse error 当试图处理“faultResponse”消息时,我得到一个解析错误

I made sure I'm capturing the exception code and it says it's a parse error. 我确定我正在捕获异常代码,它说这是一个解析错误。 "Expected <". “预期<”。 I'm looking at the sending system and they log what they send, so I know it's not missing an <. 我正在查看发送系统并记录他们发送的内容,所以我知道它不会错过<。 I tried xmllint to verify it's a good file and xmllint says it's good 我试过xmllint来验证它是一个好文件,而xmllint说它很好

Actual XML being sent from remote system 从远程系统发送的实际XML

<FaultResponse sequenceNumber="10004993">
  <Exception type="System.Exception">
    <message>Distribution Exception: </message>
    <detail>System.Exception: Distribution Exception:  ---&gt; System.Exception: Error copying "AcomSubscriber.xds" to "\\ACOM-P40\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P42\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P39\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P41\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P44\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P43\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P47\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P49\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P45\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P48\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P50\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P46\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P51\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
   --- End of inner exception stack trace ---</detail>
    <Exception type="System.Exception">
      <message>Error copying "AcomSubscriber.xds" to "\\ACOM-P40\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P42\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P39\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P41\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P44\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P43\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P47\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P49\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P45\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P48\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P50\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P46\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P51\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password</message>
      <detail>System.Exception: Error copying "AcomSubscriber.xds" to "\\ACOM-P40\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P42\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P39\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P41\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P44\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P43\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P47\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P49\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P45\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P48\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P50\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P46\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password
Error copying "AcomSubscriber.xds" to "\\ACOM-P51\C$\Program files (x86)\Zetron\AcomConsole"; Exception: Logon failure: unknown user name or bad password</detail>
    </Exception>
  </Exception>
</FaultResponse>
// get message from system and store in variable target
rapidxml::xml_document<> doc;
try
{
  doc.parse<0>(target);
}
catch (const std::runtime_error& e)
{
  std::cerr << "Runtime error was: " << e.what() << std::endl;
}
catch (const rapidxml::parse_error& e)
{
  std::cerr << "Parse error was: " << e.what() << std::endl;
  cout << "Trying to parse: " << target << " of size " << strlen(target) << endl;
}
catch (const std::exception& e)
{
  std::cerr << "Error was: " << e.what() << std::endl;
}
catch (...)
{
  std::cerr << "An unknown error occurred." << std::endl;
}

I expected to get the doc variable to have the contents of the xml document and start working my way through it, but I get the parse error. 我希望得到doc变量来获取xml文档的内容并开始通过它,但是我得到了解析错误。

I've done some more testing and it appears the XML file is valid and able to be parsed. 我已经做了一些测试,看起来XML文件是有效的并且能够被解析。 I created a separate program to test it and rapidxml worked just fine. 我创建了一个单独的程序来测试它,并且rapidxml工作正常。 Looks like something is corrupting the target variable. 看起来有些东西正在腐蚀目标变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM