public class XmlMapper
extends com.fasterxml.jackson.databind.ObjectMapper
ObjectMapper
that will read and write XML instead of JSON,
using XML-backed JsonFactory
implementation (XmlFactory
).
Mapper itself overrides some aspects of functionality to try to handle data binding aspects as similar to JAXB as possible.
Note that most of configuration should be done by pre-constructing
JacksonXmlModule
explicitly, instead of relying on default settings.
Modifier and Type | Class and Description |
---|---|
static class |
XmlMapper.Builder
Builder implementation for constructing
XmlMapper instances. |
Modifier and Type | Field and Description |
---|---|
protected JacksonXmlModule |
_xmlModule |
protected static JacksonXmlModule |
DEFAULT_XML_MODULE |
protected static DefaultXmlPrettyPrinter |
DEFAULT_XML_PRETTY_PRINTER |
_coercionConfigs, _configOverrides, _deserializationConfig, _deserializationContext, _injectableValues, _jsonFactory, _mixIns, _registeredModuleTypes, _rootDeserializers, _serializationConfig, _serializerFactory, _serializerProvider, _subtypeResolver, _typeFactory, DEFAULT_ANNOTATION_INTROSPECTOR, DEFAULT_BASE
Modifier | Constructor and Description |
---|---|
|
XmlMapper() |
|
XmlMapper(JacksonXmlModule module) |
|
XmlMapper(XmlFactory xmlFactory) |
|
XmlMapper(XmlFactory xmlFactory,
JacksonXmlModule module) |
|
XmlMapper(XMLInputFactory inputF) |
|
XmlMapper(XMLInputFactory inputF,
XMLOutputFactory outF) |
protected |
XmlMapper(XmlMapper src) |
Modifier and Type | Method and Description |
---|---|
protected com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder<?> |
_constructDefaultTypeResolverBuilder(com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping applicability,
com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator ptv) |
static XmlMapper.Builder |
builder() |
static XmlMapper.Builder |
builder(XmlFactory streamFactory) |
com.fasterxml.jackson.databind.ObjectMapper |
configure(FromXmlParser.Feature f,
boolean state) |
com.fasterxml.jackson.databind.ObjectMapper |
configure(ToXmlGenerator.Feature f,
boolean state) |
XmlMapper |
copy() |
com.fasterxml.jackson.databind.ObjectMapper |
disable(FromXmlParser.Feature f) |
com.fasterxml.jackson.databind.ObjectMapper |
disable(ToXmlGenerator.Feature f) |
com.fasterxml.jackson.databind.ObjectMapper |
enable(FromXmlParser.Feature f) |
com.fasterxml.jackson.databind.ObjectMapper |
enable(ToXmlGenerator.Feature f) |
XmlFactory |
getFactory() |
<T> T |
readValue(XMLStreamReader r,
Class<T> valueType)
Method for reading a single XML value from given XML-specific input
source; useful for incremental data-binding, combining traversal using
basic Stax
XMLStreamReader with data-binding by Jackson. |
<T> T |
readValue(XMLStreamReader r,
com.fasterxml.jackson.databind.JavaType valueType)
Method for reading a single XML value from given XML-specific input
source; useful for incremental data-binding, combining traversal using
basic Stax
XMLStreamReader with data-binding by Jackson. |
<T> T |
readValue(XMLStreamReader r,
com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef)
Method for reading a single XML value from given XML-specific input
source; useful for incremental data-binding, combining traversal using
basic Stax
XMLStreamReader with data-binding by Jackson. |
XmlMapper |
setDefaultUseWrapper(boolean state)
Deprecated.
Since 2.10 use
XmlMapper.Builder.defaultUseWrapper(boolean) instead |
void |
setXmlNameProcessor(XmlNameProcessor processor) |
protected void |
setXMLTextElementName(String name)
Deprecated.
Since 2.10 use
XmlMapper.Builder.nameForTextElement(String) instead |
com.fasterxml.jackson.core.Version |
version() |
void |
writeValue(XMLStreamWriter w0,
Object value)
Method for serializing given value using specific
XMLStreamReader :
useful when building large XML files by binding individual items, one at
a time. |
static XmlMapper.Builder |
xmlBuilder() |
_assertNotNull, _checkInvalidCopy, _configAndWriteValue, _convert, _findRootDeserializer, _initForReading, _newReader, _newReader, _newWriter, _newWriter, _newWriter, _readMapAndClose, _readTreeAndClose, _readValue, _serializerProvider, _verifyNoTrailingTokens, _verifySchemaType, _writeValueAndClose, acceptJsonFormatVisitor, acceptJsonFormatVisitor, activateDefaultTyping, activateDefaultTyping, activateDefaultTyping, activateDefaultTypingAsProperty, addHandler, addMixIn, addMixInAnnotations, canDeserialize, canDeserialize, canSerialize, canSerialize, clearProblemHandlers, coercionConfigDefaults, coercionConfigFor, coercionConfigFor, configOverride, configure, configure, configure, configure, configure, configure, constructType, constructType, convertValue, convertValue, convertValue, copyWith, createArrayNode, createDeserializationContext, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createNonBlockingByteArrayParser, createObjectNode, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, deactivateDefaultTyping, defaultClassIntrospector, disable, disable, disable, disable, disable, disable, disable, disableDefaultTyping, enable, enable, enable, enable, enable, enable, enable, enableDefaultTyping, enableDefaultTyping, enableDefaultTyping, enableDefaultTypingAsProperty, findAndRegisterModules, findMixInClassFor, findModules, findModules, generateJsonSchema, getDateFormat, getDeserializationConfig, getDeserializationContext, getInjectableValues, getNodeFactory, getPolymorphicTypeValidator, getPropertyNamingStrategy, getRegisteredModuleIds, getSerializationConfig, getSerializerFactory, getSerializerProvider, getSerializerProviderInstance, getSubtypeResolver, getTypeFactory, getVisibilityChecker, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, missingNode, mixInCount, nullNode, reader, reader, reader, reader, reader, reader, reader, reader, reader, reader, reader, readerFor, readerFor, readerFor, readerForArrayOf, readerForListOf, readerForMapOf, readerForUpdating, readerWithView, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValues, readValues, readValues, readValues, registerModule, registerModules, registerModules, registerSubtypes, registerSubtypes, registerSubtypes, setAccessorNaming, setAnnotationIntrospector, setAnnotationIntrospectors, setBase64Variant, setConfig, setConfig, setConstructorDetector, setDateFormat, setDefaultAttributes, setDefaultLeniency, setDefaultMergeable, setDefaultPrettyPrinter, setDefaultPropertyInclusion, setDefaultPropertyInclusion, setDefaultSetterInfo, setDefaultTyping, setDefaultVisibility, setFilterProvider, setFilters, setHandlerInstantiator, setInjectableValues, setLocale, setMixInAnnotations, setMixInResolver, setMixIns, setNodeFactory, setPolymorphicTypeValidator, setPropertyInclusion, setPropertyNamingStrategy, setSerializationInclusion, setSerializerFactory, setSerializerProvider, setSubtypeResolver, setTimeZone, setTypeFactory, setVisibility, setVisibility, setVisibilityChecker, tokenStreamFactory, treeAsTokens, treeToValue, treeToValue, updateValue, valueToTree, writer, writer, writer, writer, writer, writer, writer, writer, writer, writer, writerFor, writerFor, writerFor, writerWithDefaultPrettyPrinter, writerWithType, writerWithType, writerWithType, writerWithView, writeTree, writeTree, writeValue, writeValue, writeValue, writeValue, writeValue, writeValueAsBytes, writeValueAsString
protected static final JacksonXmlModule DEFAULT_XML_MODULE
protected static final DefaultXmlPrettyPrinter DEFAULT_XML_PRETTY_PRINTER
protected final JacksonXmlModule _xmlModule
public XmlMapper()
public XmlMapper(XMLInputFactory inputF, XMLOutputFactory outF)
public XmlMapper(XMLInputFactory inputF)
public XmlMapper(XmlFactory xmlFactory)
public XmlMapper(JacksonXmlModule module)
public XmlMapper(XmlFactory xmlFactory, JacksonXmlModule module)
protected XmlMapper(XmlMapper src)
public XmlMapper copy()
copy
in class com.fasterxml.jackson.databind.ObjectMapper
public static XmlMapper.Builder xmlBuilder()
public static XmlMapper.Builder builder()
public static XmlMapper.Builder builder(XmlFactory streamFactory)
public com.fasterxml.jackson.core.Version version()
version
in interface com.fasterxml.jackson.core.Versioned
version
in class com.fasterxml.jackson.databind.ObjectMapper
protected com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder<?> _constructDefaultTypeResolverBuilder(com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping applicability, com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator ptv)
_constructDefaultTypeResolverBuilder
in class com.fasterxml.jackson.databind.ObjectMapper
@Deprecated protected void setXMLTextElementName(String name)
XmlMapper.Builder.nameForTextElement(String)
insteadJacksonXmlModule
to pass configuration
information to XmlFactory
, during registration; NOT
exposed as public method since configuration should be done
via JacksonXmlModule
.@Deprecated public XmlMapper setDefaultUseWrapper(boolean state)
XmlMapper.Builder.defaultUseWrapper(boolean)
insteadpublic void setXmlNameProcessor(XmlNameProcessor processor)
public XmlFactory getFactory()
getFactory
in class com.fasterxml.jackson.databind.ObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper configure(ToXmlGenerator.Feature f, boolean state)
public com.fasterxml.jackson.databind.ObjectMapper configure(FromXmlParser.Feature f, boolean state)
public com.fasterxml.jackson.databind.ObjectMapper enable(ToXmlGenerator.Feature f)
public com.fasterxml.jackson.databind.ObjectMapper enable(FromXmlParser.Feature f)
public com.fasterxml.jackson.databind.ObjectMapper disable(ToXmlGenerator.Feature f)
public com.fasterxml.jackson.databind.ObjectMapper disable(FromXmlParser.Feature f)
public <T> T readValue(XMLStreamReader r, Class<T> valueType) throws IOException
XMLStreamReader
with data-binding by Jackson.IOException
public <T> T readValue(XMLStreamReader r, com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) throws IOException
XMLStreamReader
with data-binding by Jackson.IOException
public <T> T readValue(XMLStreamReader r, com.fasterxml.jackson.databind.JavaType valueType) throws IOException
XMLStreamReader
with data-binding by Jackson.IOException
public void writeValue(XMLStreamWriter w0, Object value) throws IOException
XMLStreamReader
:
useful when building large XML files by binding individual items, one at
a time.IOException
Copyright © 2022 FasterXML. All rights reserved.