Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Issue #27
  • Loading branch information
rsoika committed Dec 8, 2024
1 parent 89b5aa8 commit 6a35aea
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ private static String wrapTextWithCDATA(String xml) {
while (matcher.find()) {
String textContent = matcher.group(1).trim();
if (!textContent.isEmpty()) {
matcher.appendReplacement(sb, "><![CDATA[" + textContent + "]]><");
// Escape special characters in the replacement string
String escapedContent = Matcher.quoteReplacement(textContent);
matcher.appendReplacement(sb, "><![CDATA[" + escapedContent + "]]><");
} else {
matcher.appendReplacement(sb, "><");
}
Expand Down

0 comments on commit 6a35aea

Please sign in to comment.