JAXB

Unmarshal XML payloads to POJOs and back using JAXB2 XML marshalling standard

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-jaxb-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 21 options, which are listed below.

Name Description Default Type

camel.dataformat.jaxb.access-external-schema-protocols

Only in use if schema validation has been enabled. Restrict access to the protocols specified for external reference set by the schemaLocation attribute, Import and Include element.

String

camel.dataformat.jaxb.content-type-header

Whether the data format should set the Content-Type header with the type from the data format. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSON

true

Boolean

camel.dataformat.jaxb.context-path

Package name where your JAXB classes are located.

String

camel.dataformat.jaxb.context-path-is-class-name

This can be set to true to mark that the contextPath is referring to a classname and not a package name.

false

Boolean

camel.dataformat.jaxb.enabled

Whether to enable auto configuration of the jaxb data format. This is enabled by default.

Boolean

camel.dataformat.jaxb.encoding

To overrule and use a specific encoding.

String

camel.dataformat.jaxb.filter-non-xml-chars

To ignore non xml characters and replace them with an empty space.

false

Boolean

camel.dataformat.jaxb.fragment

To turn on marshalling XML fragment trees. This is useful when generated code does not have XmlRootElement annotation and you need to unmarshall only part of the tree.

false

Boolean

camel.dataformat.jaxb.ignore-j-a-x-b-element

Whether to ignore JAXBElement elements - only needed to be set to false in very special use-cases.

true

Boolean

camel.dataformat.jaxb.jaxb-provider-properties

Refers to a custom java.util.Map to lookup in the registry containing custom JAXB provider properties to be used with the JAXB marshaller.

String

camel.dataformat.jaxb.must-be-j-a-x-b-element

Whether marshalling must be java objects with JAXB annotations. And if not then it fails. This option can be set to false to relax that, such as when the data is already in XML format.

false

Boolean

camel.dataformat.jaxb.namespace-prefix

When marshalling using JAXB or SOAP then the JAXB implementation will automatically assign namespace prefixes, such as ns2, ns3, ns4 etc. To control this mapping, Camel allows you to refer to a map which contains the desired mapping.

Map

camel.dataformat.jaxb.no-namespace-schema-location

To define the location of the namespaceless schema.

String

camel.dataformat.jaxb.object-factory

Whether to allow using ObjectFactory classes to create the POJO classes during marshalling.

true

Boolean

camel.dataformat.jaxb.part-class

Name of class used for fragment parsing.

String

camel.dataformat.jaxb.part-namespace

XML namespace to use for fragment parsing.

String

camel.dataformat.jaxb.pretty-print

To enable pretty printing output nicely formatted. Is by default false.

true

Boolean

camel.dataformat.jaxb.schema

To validate against an existing schema. You can use the prefix classpath:, file: or http: to specify how the resource should be resolved. You can separate multiple schema files by using the comma character.

String

camel.dataformat.jaxb.schema-location

To define the location of the schema.

String

camel.dataformat.jaxb.schema-severity-level

Sets the schema severity level to use when validating against a schema. The default value of 0 (warning) means that any error will trigger JAXB to stop. There are the following three levels: 0=warning, 1=error, 2=fatal error.

0

Integer

camel.dataformat.jaxb.xml-stream-writer-wrapper

To use a custom xml stream writer.

String