Description
As of Java 9, the Transformer class's pretty-print feature doesn't define the actual format. Therefore, whitespace-only nodes will be outputted as well. This has been discussed in this JDK bug ticket. Also, Java 9's release note has explained this in the xml/jaxp section.
If we want our pretty-print method to always generate the same format under various Java versions, we need to provide a stylesheet file.
ref:
https://bugs.openjdk.java.net/browse/JDK-8262285?attachmentViewMode=list
https://www.baeldung.com/java-pretty-print-xml#pretty-printing-xml-with-the-transformer-class
Attachments
Issue Links
- is duplicated by
-
ARCHETYPE-584 Resulting root pom.xml from archetype generation has additional newlines with JDK11
- Closed
-
ARCHETYPE-587 Multi-modules Archetypes' Root POM file contains empty lines in Java 11
- Closed
-
ARCHETYPE-647 additional new lines in generated pom.xml
- Closed
- links to