Add DefaultXmlPrettyPrinter.withCustomNewLine() to configure linefeed for XML pretty-printing · Issue #560 · FasterXML/jackson-dataformat-xml (original) (raw)

Jackson version: 2.14.1

In ObjectMapper case, we can do the following:

objectMapper.setDefaultPrettyPrinter(new DefaultPrettyPrinter().withObjectIndenter(new DefaultIndenter().withLinefeed("\n")));

However in XmlMapper. the default implementation Lf2SpacesIndenter

  1. Is protected
  2. Doesn't seem to support a custom line separator

Does it mean we need to provide our own implementation of Indenter just to have a different line separator?