Top Description Inners Fields Constructors Methods
com.fasterxml.jackson.dataformat.xml.util

public Class DefaultXmlPrettyPrinter

extends Object
implements XmlPrettyPrinter, Instantiatable<DefaultXmlPrettyPrinter>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, com.fasterxml.jackson.core.util.Instantiatable, com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter, com.fasterxml.jackson.core.PrettyPrinter
Imports
java.io.IOException, java.math.BigDecimal, .BigInteger, java.util.Arrays, javax.xml.XMLConstants, javax.xml.stream.XMLStreamException, org.codehaus.stax2.XMLStreamWriter2, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.util.Instantiatable, com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter, com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator

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...).

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
DefaultXmlPrettyPrinter.FixedSpaceIndenter

This is a very simple indenter that only every adds a single space for indentation.

public static interface
DefaultXmlPrettyPrinter.Indenter

Interface that defines objects that can produce indentation used to separate object entries and array values.

protected class
DefaultXmlPrettyPrinter.Lf2SpacesIndenter

Default linefeed-based indenter uses system-specific linefeeds and 2 spaces for indentation per level.

protected static class
DefaultXmlPrettyPrinter.NopIndenter

Dummy implementation that adds no indentation whatsoever

Field Summary

Modifier and TypeField and Description
protected DefaultXmlPrettyPrinter.Indenter
_arrayIndenter

By default, let's use only spaces to separate array values.

protected transient boolean
_justHadStartElement

Marker flag set on start element, and cleared if an end element is encountered.

protected transient int
_nesting

Number of open levels of nesting.

protected String
protected DefaultXmlPrettyPrinter.Indenter
_objectIndenter

By default, let's use linefeed-adding indenter for separate object entries.

private static final long
pack-priv static final int
pack-priv static final char[]
private static final String
SYSTEM_DEFAULT_NEW_LINE

By default, will try to set as System.getProperty("line.separator").

Constructor Summary

AccessConstructor and Description
public
protected

Method Summary

Modifier and TypeMethod and Description
public void
beforeArrayValues(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.beforeArrayValues.

Method called after array start marker has been output, and right before the first value is to be output.

public void
beforeObjectEntries(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.beforeObjectEntries.

Method called after object start marker has been output, and right before the field name of the first entry is to be output.

public DefaultXmlPrettyPrinter
createInstance()

Implements com.fasterxml.jackson.core.util.Instantiatable.createInstance.

Method called to ensure that we have a non-blueprint object to use; it is either this object (if stateless), or a newly created object with separate state.

public void
public void
public DefaultXmlPrettyPrinter
withCustomNewLine(String newLine)

Sets custom new-line.

public void
writeArrayValueSeparator(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeArrayValueSeparator.

Method called after an array value has been completely output, and before another value is to be output.

public void
writeEndArray(JsonGenerator
Generator used for output
gen
,
int
Number of direct members of the array that have been output
nrOfValues
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeEndArray.

Method called after an Array value has been completely output (minus closing bracket).

public void
writeEndElement(XMLStreamWriter2 sw, int nrOfEntries)

Implements com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter.writeEndElement.

Method for forcibly writing an end element, without going through Jackson generator (and thus, without updating currently active element stack)

public void
writeEndObject(JsonGenerator
Generator used for output
gen
,
int
Number of direct members of the Object that have been output
nrOfEntries
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeEndObject.

Method called after an Object value has been completely output (minus closing curly bracket).

public void
public void
writeLeafElement(XMLStreamWriter2 sw, String nsURI, String localName, char[] buffer, int offset, int len, boolean isCData)

Implements com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter.writeLeafElement.

public void
public void
public void
public void
public void
public void
public void
public void
writeLeafElement(XMLStreamWriter2 sw, String nsURI, String localName, Base64Variant base64variant, byte[] data, int offset, int len)

Implements com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter.writeLeafElement.

public void
public void
public void
writeObjectEntrySeparator(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeObjectEntrySeparator.

Method called after an Object entry (field:value) has been completely output, and before another value is to be output.

public void
writeObjectFieldValueSeparator(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeObjectFieldValueSeparator.

Method called after an object field has been output, but before the value is output.

public void
writePrologLinefeed(XMLStreamWriter2 sw)

Implements com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter.writePrologLinefeed.

Method for trying to write a linefeed to separate entities outside of the root element (that is, in prolog or epilog), most often called to separate XML declaration from the root element.

public void
writeRootValueSeparator(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeRootValueSeparator.

Method called after a root-level value has been completely output, and before another value is to be output.

public void
writeStartArray(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeStartArray.

Method called when an Array value is to be output, before any member/child values are output.

public void
writeStartElement(XMLStreamWriter2 sw, String nsURI, String localName)

Implements com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter.writeStartElement.

Method for forcibly writing a start element, without going through Jackson generator (and thus, without updating currently active element stack)

public void
writeStartObject(JsonGenerator
Generator used for output
gen
)

Implements com.fasterxml.jackson.core.PrettyPrinter.writeStartObject.

Method called when an Object value is to be output, before any fields are output.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait