Я пытаюсь разобрать ответ от другой системы в формате XML. Я решил использовать RapidXML в качестве парсера. Все шло нормально, пока система не выдала сообщение «faultResponse». При попытке обработать сообщение «faultResponse» я получаю ошибку разбора
Я убедился, что записываю код исключения, и он говорит, что это ошибка разбора. «Ожидается <». Я смотрю на систему отправки, и они регистрируют то, что отправляют, поэтому я знаю, что она не пропускает <. Я попытался xmllint, чтобы убедиться, что это хороший файл, и xmllint говорит, что это хорошо </p>
Фактический XML отправляется из удаленной системы
<FaultResponse sequenceNumber="10004993">
<Exception type="System.Exception">
<message>Distribution Exception: </message>
<detail>System.Exception: Distribution Exception: ---> 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;
}
Я ожидал, что переменная doc будет содержать содержимое документа xml и начнет работать по нему, но я получаю ошибку разбора.