- All Implemented Interfaces:
Serializable,Comparable<XmlReadFeature>,Constable,tools.jackson.core.FormatFeature,tools.jackson.core.util.JacksonFeature
NOTE: in Jackson 2.x this was named FromXmlParser.Feature.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFeature that enables automatic conversion of incoming "xsi:type" (where "type" is the local name and "xsi" prefix is bound to URIXMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI), into Jackson simple Property Name of"xsi:type".Feature that indicates whether empty XML elements (both empty tags like<tag />and<tag></tag>(with no intervening cdata) are exposed asJsonToken.VALUE_NULL) or not.Feature that controls whether the name of the root XML element is verified against the expected root name during deserialization.Feature that indicates whether XML Schema Instance attributexsi:nilwill be processed automatically -- to indicatenullvalues -- or not.Feature that controls whether XML Schema Instance (XSI) namespace attributes other thanxsi:nilandxsi:type(which have their own handling viaPROCESS_XSI_NILandAUTO_DETECT_XSI_TYPE) are silently skipped during deserialization.Feature that, when enabled, exposes the XML root element as an extra outer Object wrapper whose single property is named after the root element's local name. -
Method Summary
Modifier and TypeMethodDescriptionstatic intMethod that calculates bit set (flags) of all features that are enabled by default.booleanbooleanenabledIn(int flags) intgetMask()static XmlReadFeatureReturns the enum constant of this class with the specified name.static XmlReadFeature[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
AUTO_DETECT_XSI_TYPE
Feature that enables automatic conversion of incoming "xsi:type" (where "type" is the local name and "xsi" prefix is bound to URIXMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI), into Jackson simple Property Name of"xsi:type". This is usually needed to read content written using matchingToXmlGenerator.Feature#AUTO_DETECT_XSI_TYPEfeature, usually used for Polymorphic handling where it is difficult to specify proper XML Namespace for type identifier.Default setting is
true(wasfalsein Jackson 2.x). -
EMPTY_ELEMENT_AS_NULL
Feature that indicates whether empty XML elements (both empty tags like<tag />and<tag></tag>(with no intervening cdata) are exposed asJsonToken.VALUE_NULL) or not. If they are not returned as `null` tokens, they will be returned asJsonToken.VALUE_STRINGtokens with textual value of "" (empty String).NOTE: in Jackson 2.x, only "true" empty tags were affected, not split ones. With 3.x both cases handled uniformly.
Default setting is
false. -
ENFORCE_ROOT_ELEMENT_NAME
Feature that controls whether the name of the root XML element is verified against the expected root name during deserialization. The expected root name is determined from@JsonRootName,@JacksonXmlRootElement, or the simple class name of the target type (in that priority order).When enabled, a mismatch between the actual root element name and the expected name will result in a
MismatchedInputException. When disabled (the default), any root element name is accepted. Note that Fully-Qualified Names (FQN) comparison is used: that is, both local name and namespace URI must match.Default setting is
falsefor backwards-compatibility.- Since:
- 3.2
-
PROCESS_XSI_NIL
Feature that indicates whether XML Schema Instance attributexsi:nilwill be processed automatically -- to indicatenullvalues -- or not. If enabled,xsi:nilattribute on any XML element will mark such elements as "null values" and any other attributes or child elements they might have to be ignored. If disabled this attribute will be exposed like any other attribute.Default setting is
true. -
SKIP_UNKNOWN_XSI_ATTRIBUTES
Feature that controls whether XML Schema Instance (XSI) namespace attributes other thanxsi:nilandxsi:type(which have their own handling viaPROCESS_XSI_NILandAUTO_DETECT_XSI_TYPE) are silently skipped during deserialization. Attributes affected includexsi:schemaLocationandxsi:noNamespaceSchemaLocation.When enabled, these attributes are ignored and will not cause
UnrecognizedPropertyException. When disabled (default), they are exposed as regular attributes and may require matching POJO properties orDeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIESto be disabled.Default setting is
false.- Since:
- 3.2
-
WRAP_ROOT_ELEMENT_NAME
Feature that, when enabled, exposes the XML root element as an extra outer Object wrapper whose single property is named after the root element's local name. This preserves the root name in the resulting token stream (and therefore inJsonNode,Map, etc.), which is otherwise discarded.Example: with this feature enabled,
<root><value>3</value></root>
is exposed as token stream equivalent to{ "root" : { "value" : "3" } }instead of the default{ "value" : "3" }The wrapper is purely a token-stream-level addition; the body is exposed exactly as it would be without wrap. Roots that the parser would otherwise expose asnull(xsi:nilor, withEMPTY_ELEMENT_AS_NULLenabled, empty elements) become{ "root" : null }.Designed to pair with
XmlWriteFeature.UNWRAP_ROOT_OBJECT_NODEto allow lossless round-tripping of root element name via the Tree Model (JsonNode) andMapbindings.Notes:
- The wrapper key uses the root element's local name only;
namespace URI is not encoded into the key (consistent with how
child element names are exposed throughout this parser). The full
QNameof the root remains accessible viaFromXmlParser.getRootElementName(). - This feature modifies the token stream, so it affects all
bindings (POJO,
Map,JsonNode), not just Tree Model.
Default setting is
falsefor backwards-compatibility.- Since:
- 3.2
- The wrapper key uses the root element's local name only;
namespace URI is not encoded into the key (consistent with how
child element names are exposed throughout this parser). The full
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
collectDefaults
public static int collectDefaults()Method that calculates bit set (flags) of all features that are enabled by default. -
enabledByDefault
public boolean enabledByDefault()- Specified by:
enabledByDefaultin interfacetools.jackson.core.util.JacksonFeature
-
getMask
public int getMask()- Specified by:
getMaskin interfacetools.jackson.core.util.JacksonFeature
-
enabledIn
public boolean enabledIn(int flags) - Specified by:
enabledInin interfacetools.jackson.core.util.JacksonFeature
-