xml dump: fixed some bad xml output in the token list dump
This commit is contained in:
parent
2f7b8fe4b2
commit
b6a9c53826
|
@ -3785,6 +3785,7 @@ void Tokenizer::printDebugOutput() const
|
||||||
static std::string toxml(const std::string &str)
|
static std::string toxml(const std::string &str)
|
||||||
{
|
{
|
||||||
std::ostringstream xml;
|
std::ostringstream xml;
|
||||||
|
const bool isstring(str[0] == '\"');
|
||||||
for (std::size_t i = 0U; i < str.length(); i++) {
|
for (std::size_t i = 0U; i < str.length(); i++) {
|
||||||
char c = str[i];
|
char c = str[i];
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -3800,8 +3801,14 @@ static std::string toxml(const std::string &str)
|
||||||
case '\"':
|
case '\"':
|
||||||
xml << """;
|
xml << """;
|
||||||
break;
|
break;
|
||||||
|
case '\0':
|
||||||
|
xml << "\\0";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (!isstring || (c >= ' ' && c <= 'z'))
|
||||||
xml << c;
|
xml << c;
|
||||||
|
else
|
||||||
|
xml << 'x';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue