Class DefaultXmlPrettyPrinter

java.lang.Object
com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter
All Implemented Interfaces:
com.fasterxml.jackson.core.PrettyPrinter, com.fasterxml.jackson.core.util.Instantiatable<DefaultXmlPrettyPrinter>, XmlPrettyPrinter, Serializable

public class DefaultXmlPrettyPrinter extends Object implements XmlPrettyPrinter, com.fasterxml.jackson.core.util.Instantiatable<DefaultXmlPrettyPrinter>, Serializable
Indentation to use with XML is different from JSON, because JSON requires use of separator characters and XML just basic whitespace.

Note that only a subset of methods of PrettyPrinter actually get called by ToXmlGenerator; because of this, implementation is bit briefer (and uglier...).

See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • _arrayIndenter

      protected DefaultXmlPrettyPrinter.Indenter _arrayIndenter
      By default, let's use only spaces to separate array values.
    • _objectIndenter

      protected DefaultXmlPrettyPrinter.Indenter _objectIndenter
      By default, let's use linefeed-adding indenter for separate object entries. We'll further configure indenter to use system-specific linefeeds, and 2 spaces per level (as opposed to, say, single tabs)
    • SYSTEM_DEFAULT_NEW_LINE

      private static final String SYSTEM_DEFAULT_NEW_LINE
      By default, will try to set as System.getProperty("line.separator"). Can later set custom new line with withCustomNewLine method.
      Since:
      2.15
    • _newLine

      protected String _newLine
    • SPACE_COUNT

      static final int SPACE_COUNT
      See Also:
    • SPACES

      static final char[] SPACES
    • _nesting

      protected transient int _nesting
      Number of open levels of nesting. Used to determine amount of indentation to use.
    • _justHadStartElement

      protected transient boolean _justHadStartElement
      Marker flag set on start element, and cleared if an end element is encountered. Used for suppressing indentation to allow empty elements.
      Since:
      2.3
  • Constructor Details

    • DefaultXmlPrettyPrinter

      public DefaultXmlPrettyPrinter()
    • DefaultXmlPrettyPrinter

      protected DefaultXmlPrettyPrinter(DefaultXmlPrettyPrinter base)
  • Method Details