Splitting XML messages
XML is one of the most frequently split payload types. This recipe will show how you can use Camel's support for implicit type conversion, and XPath support, to process XML fragments individually.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.splitjoin.splitxml
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with splitXml
.
How to do it...
Consider the following XML file:
<books> <book category="Tech" title="Apache Camel Developer's Cookbook"> <authors> <author>Scott Cranton</author> <author>Jakub Korab</author> </authors> </book> <book category="Cooking" title="Camel Cookbook"> <authors> <author>Heston Ramsey</author> <author>Gordon Blumenthal</author> </authors> </book> </books>...