diff options
Diffstat (limited to 'zenXml')
-rw-r--r-- | zenXml/zenxml/parser.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/zenXml/zenxml/parser.h b/zenXml/zenxml/parser.h index f7604ebf..dbf5a8c4 100644 --- a/zenXml/zenxml/parser.h +++ b/zenXml/zenxml/parser.h @@ -79,31 +79,31 @@ std::string normalize(const std::string& str, Predicate pred) //pred: unary func { std::string output; for (const char c : str) - { - if (c == '&') // - output += "&"; - else if (c == '<') //normalization mandatory: https://www.w3.org/TR/xml/#syntax - output += "<"; - else if (c == '>') // - output += ">"; - else if (pred(c)) + switch (c) { - if (c == '\'') - output += "'"; - else if (c == '"') - output += """; - else - { - output += "&#x"; - const auto [high, low] = hexify(c); - output += high; - output += low; - output += ';'; - } + //*INDENT-OFF* + case '&': output += "&"; break; // + case '<': output += "<"; break; //normalization mandatory: https://www.w3.org/TR/xml/#syntax + case '>': output += ">"; break; // + default: + if (pred(c)) + { + if (c == '\'') output += "'"; + else if (c == '"') output += """; + else + { + output += "&#x"; + const auto [high, low] = hexify(c); + output += high; + output += low; + output += ';'; + } + } + else + output += c; + break; + //*INDENT-ON* } - else - output += c; - } return output; } |