Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ public void doGet(final HttpServletRequest request, final HttpServletResponse re

final StandardTransformProvider transformProvider = new StandardTransformProvider();
transformProvider.setIndent(true);
transformProvider.setOmitXmlDeclaration(true);

transformProvider.transform(source, result);
break;
}
Expand Down Expand Up @@ -198,4 +196,5 @@ private String getDisplayName(final String contentType) {
case null, default -> null;
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,20 @@ export class StandardContentViewer {
this.error = null;
this.contentLoaded = true;

this.contentFormGroup.get('value')?.setValue(content);
// For XML, clean up formatting for display
let processedContent = content;
if (this.mimeTypeDisplayName === 'xml') {
// Add newline after XML declaration if missing (<?xml ...?><root> -> <?xml ...?>\n<root>)
processedContent = processedContent.replace(/\?></g, '?>\n<');

// Remove blank lines that appear between tags (whitespace-only text nodes)
// but preserve blank lines that are part of actual text content
// Uses \r?\n to handle both Unix (LF) and Windows (CRLF) line endings
// The capture group ($2) preserves indentation before the next tag
processedContent = processedContent.replace(/>\s*\r?\n(\s*\r?\n)+(\s*)</g, '>\n$2<');
}

this.contentFormGroup.get('value')?.setValue(processedContent);
}
});
}
Expand Down
Loading