xml dump: fixed some bad xml output in the token list dump

This commit is contained in:
Daniel Marjamäki 2014-07-14 19:49:31 +02:00
parent 2f7b8fe4b2
commit b6a9c53826
1 changed files with 8 additions and 1 deletions

View File

@ -3785,6 +3785,7 @@ void Tokenizer::printDebugOutput() const
static std::string toxml(const std::string &str)
{
std::ostringstream xml;
const bool isstring(str[0] == '\"');
for (std::size_t i = 0U; i < str.length(); i++) {
char c = str[i];
switch (c) {
@ -3800,8 +3801,14 @@ static std::string toxml(const std::string &str)
case '\"':
xml << "&quot;";
break;
case '\0':
xml << "\\0";
break;
default:
if (!isstring || (c >= ' ' && c <= 'z'))
xml << c;
else
xml << 'x';
break;
}
}