José Bustamante created CAMEL-18345:
---------------------------------------

             Summary: EMPTY_ELEMENT_AS_NULL disabled by default in 
jackson-dataformat-xml
                 Key: CAMEL-18345
                 URL: https://issues.apache.org/jira/browse/CAMEL-18345
             Project: Camel
          Issue Type: Bug
          Components: camel-jacksonxml
    Affects Versions: 3.3.0
            Reporter: José Bustamante


Jackson 2.12.x changed the default for the 'EMPTY_ELEMENT_AS_NULL' feature from 
true to false (see 
[here|[https://github.com/FasterXML/jackson-dataformat-xml/issues/411]]) and we 
can enable back this property using XMLMapper:
{quote}xmlMapper.configure(FromXmlParser.Feature.EMPTY_ELEMENT_AS_NULL, true);
{quote}
However, there's no way to enable this behaviour in jaxonxml inside camel 
routes. In the 
[documentation|[https://camel.apache.org/components/3.14.x/dataformats/jacksonxml-dataformat.html#_enabling_or_disable_features_using_jackson],]
 It's specified that we can enable or disable certain types of properties that 
are inside SerializationFeature, DeserializationFeature and MapperFeature but 
there's no way to enable EMPTY_ELEMENT_AS_NULL since is in another enum 
(FromXmlParser). We've tried enabling the feature 
ACCEPT_EMPTY_STRING_AS_NULL_OBJECT but that doesn't work either.

We've managed to implement a workaround by using <bean> instead of <jacksonxml> 
in our camel routes (we use Camel XML DSL), but that's not efficient as we 
would have to replace all <jacksonxml> references. So we need to have the 
possibility to enable back EMPTY_ELEMENT_AS_NULL from <jacksonxml> in camel XML 
DSL.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to