Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DefaultXmlPrettyPrinter.withCustomNewLine() to configure linefeed for XML pretty-printing #560

Closed
koalalam opened this issue Dec 8, 2022 · 1 comment
Labels
2.15 For issues planned for 2.15
Milestone

Comments

@koalalam
Copy link

koalalam commented Dec 8, 2022

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?

@cowtowncoder
Copy link
Member

Seems like an oversight, thank you for reporting it.

If you have time and interest, a PR would make sense, if you end up trying writing a custom implementation anyway.

@cowtowncoder cowtowncoder added good first issue Issue that seems easy to resolve and is likely a good candidate for contributors new to project 2.15 For issues planned for 2.15 pr-needed Feature request for which PR likely needed (no active development but idea is workable) labels Dec 9, 2022
@cowtowncoder cowtowncoder changed the title No easy way to use "\n" line separator in XmlMapper Add DefaultXmlPrettyPrinter.withCustomNewLine() to configure linefeed for XML pretty-printing Feb 17, 2023
@cowtowncoder cowtowncoder removed good first issue Issue that seems easy to resolve and is likely a good candidate for contributors new to project pr-needed Feature request for which PR likely needed (no active development but idea is workable) labels Feb 17, 2023
@cowtowncoder cowtowncoder added this to the 2.15.0 milestone Feb 17, 2023
cowtowncoder added a commit that referenced this issue Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.15 For issues planned for 2.15
Projects
None yet
Development

No branches or pull requests

2 participants