Skip to content

DefaultXmlPrettyPrinter indentation configuration not preserved #222

@jtuc

Description

@jtuc

I want to prettyprint XML with a \n character, disregarding the system dependent line feed/carriage return settings.

I thought that the following code would be sufficient:

XmlMapper xmlMapper = new XmlMapper();
DefaultXmlPrettyPrinter pp = new DefaultXmlPrettyPrinter();
pp.indentObjectsWith(new Newline2SpacesIndenter());
ObjectWriter xmlWriter = xmlMapper.writer(pp);

Where Newline2SpacesIndenter() is my custom indenter.

However, attempting to use the resulting ObjectWriter doesn't result in the expected behaviour - the customized indenter is lost, as DefaultXmlPrettyPrinter.createInstance() doesn't preserve configuration.

Is this a bug, or am I attempting to configure things in the wrong place?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions