#180 Line feeds within XML comments updated incorrectly

open
nobody
None
5
2012-10-08
2008-02-28
Janne
No

It seems as pretty printing (dom4j 1.6.1) updates line feeds incorrectly for XML comments.

Using the following settings for OutputFormat:
OutputFormat xmlOutput = OutputFormat.createPrettyPrint();
xmlOutput.setExpandEmptyElements(false);
xmlOutput.setIndent(true);
xmlOutput.setIndent(" ");
xmlOutput.setIndentSize(2);
xmlOutput.setLineSeparator(System.getProperty("line.separator"));
xmlOutput.setNewLineAfterDeclaration(false);
xmlOutput.setNewLineAfterNTags(0);
xmlOutput.setNewlines(true);
xmlOutput.setOmitEncoding(false);
xmlOutput.setPadText(false);
xmlOutput.setSuppressDeclaration(false);
xmlOutput.setTrimText(false);

Applied on an XML file with Windows style line separators, existing XML comments are updated to something else ('\n' I belive), leaving the XML-file with inconsistent line endings. The rest of the document behaves as expected...

I would have expected everything but CDATA content to be updated with line separators as configured...

Discussion