Jackson XML annotations
Jackson XML annotations
Jackson XML annotations
@JacksonXmlElementWrapper
Allows specifying XML element to use for wrapping List and Map properties; or disabling use (with 'useWrapping' set to false).
Properties:
namespace
(default: ""): Which XML namespace to use for wrapper element (defaults to: "")localName
: Local name for wrapper elementuseWrapping
(default:true) Whether to use wrapper element or not: by specifying 'false' one can disable use
@JacksonXmlProperty
Allows specifying XML namespace and local name for a property; as well as whether property is to be written as an XML element or attribute.
Properties:
namespace
(default: ""): Which XML namespace to use for property element or attributelocalName
: Local name of property element or attributeisAttribute
(default: false): Whether property should be serialized as an attribute (true) or element (false)
@JacksonXmlRootElement
Allows specifying XML element to use for wrapping the root element (default uses 'simple name' of the value class). This only needs to be used for objects serialized as root values: for other values property name is used; for root values there is no referring property and separate annotation is needed on class itself.
Properties:
namespace
(default: ""): Which XML namespace to use for root elementlocalName
: Local name of root element
@JacksonXmlText
Allows specifying that value of one property is to be serialized as "unwrapped" text, and not in an element.
Properties:
value
(default: true): Whether annotated property value is to be serialized as basic XML text (without surrounding XML element) or not.