|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter
public class DefaultXmlPrettyPrinter
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 Class Summary | |
---|---|
protected static class |
DefaultXmlPrettyPrinter.FixedSpaceIndenter
This is a very simple indenter that only every adds a single space for indentation. |
static interface |
DefaultXmlPrettyPrinter.Indenter
Interface that defines objects that can produce indentation used to separate object entries and array values. |
protected static 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 | |
---|---|
protected DefaultXmlPrettyPrinter.Indenter |
_arrayIndenter
By default, let's use only spaces to separate array values. |
protected int |
_nesting
Number of open levels of nesting. |
protected DefaultXmlPrettyPrinter.Indenter |
_objectIndenter
By default, let's use linefeed-adding indenter for separate object entries. |
protected boolean |
_spacesInObjectEntries
By default we will add spaces around colons used to separate object fields and values. |
Constructor Summary | |
---|---|
DefaultXmlPrettyPrinter()
|
Method Summary | |
---|---|
void |
beforeArrayValues(com.fasterxml.jackson.core.JsonGenerator jgen)
|
void |
beforeObjectEntries(com.fasterxml.jackson.core.JsonGenerator jgen)
|
void |
indentArraysWith(DefaultXmlPrettyPrinter.Indenter i)
|
void |
indentObjectsWith(DefaultXmlPrettyPrinter.Indenter i)
|
void |
spacesInObjectEntries(boolean b)
|
void |
writeArrayValueSeparator(com.fasterxml.jackson.core.JsonGenerator jgen)
|
void |
writeEndArray(com.fasterxml.jackson.core.JsonGenerator jgen,
int nrOfValues)
|
void |
writeEndObject(com.fasterxml.jackson.core.JsonGenerator jgen,
int nrOfEntries)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
BigDecimal value)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
BigInteger value)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
boolean value)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
byte[] data,
int offset,
int len)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
char[] buffer,
int offset,
int len)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
double value)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
float value)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
int value)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
long value)
|
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
String text)
|
void |
writeLeafNullElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName)
|
void |
writeObjectEntrySeparator(com.fasterxml.jackson.core.JsonGenerator jgen)
|
void |
writeObjectFieldValueSeparator(com.fasterxml.jackson.core.JsonGenerator jgen)
|
void |
writeRootValueSeparator(com.fasterxml.jackson.core.JsonGenerator jgen)
|
void |
writeStartArray(com.fasterxml.jackson.core.JsonGenerator jgen)
|
void |
writeStartObject(com.fasterxml.jackson.core.JsonGenerator jgen)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DefaultXmlPrettyPrinter.Indenter _arrayIndenter
protected DefaultXmlPrettyPrinter.Indenter _objectIndenter
protected boolean _spacesInObjectEntries
protected int _nesting
Constructor Detail |
---|
public DefaultXmlPrettyPrinter()
Method Detail |
---|
public void indentArraysWith(DefaultXmlPrettyPrinter.Indenter i)
public void indentObjectsWith(DefaultXmlPrettyPrinter.Indenter i)
public void spacesInObjectEntries(boolean b)
public void writeRootValueSeparator(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeRootValueSeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void beforeArrayValues(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
beforeArrayValues
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeStartArray(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeStartArray
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeArrayValueSeparator(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeArrayValueSeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeEndArray(com.fasterxml.jackson.core.JsonGenerator jgen, int nrOfValues) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeEndArray
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void beforeObjectEntries(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
beforeObjectEntries
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeStartObject(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeStartObject
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeObjectEntrySeparator(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeObjectEntrySeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeObjectFieldValueSeparator(com.fasterxml.jackson.core.JsonGenerator jgen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeObjectFieldValueSeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeEndObject(com.fasterxml.jackson.core.JsonGenerator jgen, int nrOfEntries) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
writeEndObject
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, String text) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, char[] buffer, int offset, int len) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, boolean value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, int value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, long value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, double value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, float value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, BigInteger value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, BigDecimal value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, byte[] data, int offset, int len) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafNullElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName) throws XMLStreamException
writeLeafNullElement
in interface XmlPrettyPrinter
XMLStreamException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |