From a5302b8934c9a95fd0a3af5c0793789ce0007a9b Mon Sep 17 00:00:00 2001 From: Lloyd McKenzie Date: Fri, 4 Mar 2022 21:55:31 -0700 Subject: [PATCH] Fix XML escaping to not escape single-quotes - because our XML serializer always wraps attributes in double-quotes, making escaping unnecessary. --- .../src/main/java/org/hl7/fhir/utilities/xml/XMLUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XMLUtil.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XMLUtil.java index 9e0ad4116..34ba270a5 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XMLUtil.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XMLUtil.java @@ -273,9 +273,9 @@ public class XMLUtil { for (int i = 0; i < rawContent.length(); i++) { char ch = rawContent.charAt(i); - if (ch == '\'') - sb.append("'"); - 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("&"); else if (ch == '"') sb.append(""");