diff --git a/src/formatting/formatters/v2-xml-formatter.ts b/src/formatting/formatters/v2-xml-formatter.ts index 8b0fcbb..281f631 100644 --- a/src/formatting/formatters/v2-xml-formatter.ts +++ b/src/formatting/formatters/v2-xml-formatter.ts @@ -163,6 +163,10 @@ export class V2XmlFormatter implements XmlFormatter { && ((options.splitXmlnsOnFormat && xml.substr(i, 5).toLowerCase() === "xmlns") || options.splitAttributesOnFormat)) { + + // trim the end of output here to ensure there is no trailing whitespace (issue #288) + output = this._removeTrailingNonBreakingWhitespace(output); + output += `${options.newLine}${this._getIndent(options, indentLevel)}`; } diff --git a/src/test/test-data/issue-189.formatted.xml b/src/test/test-data/issue-189.formatted.xml index b3a3d19..952ff72 100644 --- a/src/test/test-data/issue-189.formatted.xml +++ b/src/test/test-data/issue-189.formatted.xml @@ -1,5 +1,5 @@ - \ No newline at end of file diff --git a/src/test/test-data/issue-257.formatted.xml b/src/test/test-data/issue-257.formatted.xml index 842df62..7cfe79e 100644 --- a/src/test/test-data/issue-257.formatted.xml +++ b/src/test/test-data/issue-257.formatted.xml @@ -1,5 +1,5 @@ -