camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marcelcasado <>
Subject Issues using camel split(stax())
Date Tue, 03 Dec 2013 20:50:46 GMT
I have an issue using camel split with stax (2.12.1) where the
"StAXJAXBIteratorExpression" is not able to match the xml elements to the
jaxb provided class:

The route looks like this where splitClass is PricingProgramEnrollment

 .split(stax(splitClass, false))

The jaxb class with annotations looks like:

@XmlType(name = "PricingProgramEnrollmentType", propOrder = {
@XmlRootElement(name = "pricingProgramEnrollment")
public class PricingProgramEnrollment
    implements Serializable

The xml is :

<?xml version="1.0" encoding="UTF-8" ?>
        <pricingProgramEnrollment programName="cheap_energy1">
                <userEnrollment accountId="test_enrollments"
effectiveDate="2013-01-01T00:00:00.000" />

Looking to the stax component code that matches the the tag names with the
provided jaxb class I see that it uses XmlType.class first for the the
matching tag name. and XmlRootElement.class if XmlType.class is not pressent
or empty string. My jaxb class has both annotations and the stax code
selects XmlType to do the matching and that does not match the
<pricingProgramEnrollment> in the xml. Is this a bug should XmlRootElement
should be the first choice? What is the purpose to match XmlType?

public final class StAXUtil {
    private static final Map<Class&lt;?>, String> TAG_NAMES = new
LRUSoftCache<Class&lt;?>, String>(1000);

    private StAXUtil() {
        // no-op

    public static String getTagName(Class<?> handled) {
        if (TAG_NAMES.containsKey(handled)) {
            return TAG_NAMES.get(handled);

        XmlType xmlType = handled.getAnnotation(XmlType.class);
        if (xmlType != null && != null && > 0) {
        } else {
            XmlRootElement xmlRoot =
            if (xmlRoot != null && != null && > 0) {
        throw new IllegalArgumentException("XML name not found for " +


-Marcel Casado 

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message