Transforming from Java to XML with JAXB

Camel's JAXB Component is one of a number of components that can be used to convert your XML data back and forth from Java objects. It provides a Camel Data Format that allows you to use JAXB annotated Java classes, and then marshal (Java to XML) or unmarshal (XML to Java) your data.

JAXB is a Java standard for translating between XML data and Java that is used by creating annotated Java classes that bind, or map, to your XML data schema. The framework takes care of the rest.

This recipe will show you how to use the JAXB Camel Data Format to convert back and forth from Java to XML.

Getting ready

The Java code for this recipe is located in the org.camelcookbook.transformation.jaxb package. The Spring XML files ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.