From ec14ace411ee87f518ab7174a5e2e4f432486bf7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 16:29:56 +0000 Subject: [PATCH 1/2] Bump net.sf.saxon:Saxon-HE from 9.6.0-7 to 12.7 Bumps net.sf.saxon:Saxon-HE from 9.6.0-7 to 12.7. --- updated-dependencies: - dependency-name: net.sf.saxon:Saxon-HE dependency-version: '12.7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5a7a70c..1ec53b3 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ UTF-8 2.7.3 - 9.6.0-7 + 12.7 From 10927401bec9183272acc87d97be5738860207ac Mon Sep 17 00:00:00 2001 From: Ben Asmussen Date: Mon, 9 Jun 2025 16:59:13 +0000 Subject: [PATCH 2/2] Fix Saxon-HE 12 trailing newline issue in XML serialization When Saxon-HE is upgraded to version 12.x, it adds a trailing newline to XML output when indenting is enabled. This breaks backward compatibility with tests expecting the output format from Saxon 9.6. The fix trims the trailing newline in DomUtils.asXml() when indenting is enabled, maintaining consistent output across Saxon versions. Fixes #22 --- .../java/com/dataliquid/commons/xml/DomUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/dataliquid/commons/xml/DomUtils.java b/src/main/java/com/dataliquid/commons/xml/DomUtils.java index 7d5091c..4c16cf7 100644 --- a/src/main/java/com/dataliquid/commons/xml/DomUtils.java +++ b/src/main/java/com/dataliquid/commons/xml/DomUtils.java @@ -1104,7 +1104,16 @@ public static String asXml(Node node, boolean indent, Map proper StringWriter writer = new StringWriter(); write(node, writer, outputProperties); - return writer.toString(); + String result = writer.toString(); + + // Saxon 12+ adds a trailing newline when indenting is enabled, which wasn't present in Saxon 9.6 + // To maintain backward compatibility, we remove it if present + if (indent && result.endsWith("\n")) + { + result = result.substring(0, result.length() - 1); + } + + return result; }