Fix XML escaping to not escape single-quotes - because our XML serializer always wraps attributes in double-quotes, making escaping unnecessary.

This commit is contained in:
Lloyd McKenzie 2022-03-04 21:55:31 -07:00
parent 685ea98d37
commit a5302b8934
1 changed files with 3 additions and 3 deletions

View File

@ -273,9 +273,9 @@ public class XMLUtil {
for (int i = 0; i < rawContent.length(); i++) {
char ch = rawContent.charAt(i);
if (ch == '\'')
sb.append("&#39;");
else if (ch == '&')
// We don't escape ' because our code always spits out attributes surrounded by "", which means
// it's not necessary to escape ' - and it's *much* less ugly and more bandwidth-efficient when we don't.
if (ch == '&')
sb.append("&amp;");
else if (ch == '"')
sb.append("&quot;");