[ 
https://issues.apache.org/jira/browse/CAMEL-18225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17558362#comment-17558362
 ] 

Raymond commented on CAMEL-18225:
---------------------------------

I can confirm that:

    <unmarshal>
      <customDataFormat ref="myCustomDataFormat"/>
    </unmarshal>

works in 3.14.3.

I actually tried it based on the XSD, but I probably used customDataformat 
instead of customDataFormat... I also checked the migration guides (until 
3.14), but couldn't find anything specific about the "custom" --> 
"customDataFormat".

Small question: In Camel 2 one could load dataformats like this:

<camelContext xmlns="http://camel.apache.org/schema/spring";>
<dataFormats>
<crypto id="myCrypto" algorithm="DES" keyRef="secretKey"/>
</dataFormats>
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<unmarshal ref="myCrypto"/>
<to uri="mock:unencrypted"/>
</route>
</camelContext>

I know load it like this:

<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<unmarshal ref="myCrypto"/>
<to uri="mock:unencrypted"/>
</route>

Is it possible to load dataformats centrally from routeConfiguration? or do I 
need to pack it into

<routes xmlns="http://camel.apache.org/schema/spring";>
<dataFormats>
<crypto id="myCrypto" algorithm="DES" keyRef="secretKey"/>
</dataFormats>
<route>
<from uri="direct:start"/>
<marshal ref="myCrypto"/>
<to uri="mock:encrypted"/>
<unmarshal ref="myCrypto"/>
<to uri="mock:unencrypted"/>
</route>
</routes>

> Can't load custom dataformat
> ----------------------------
>
>                 Key: CAMEL-18225
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18225
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.14.3
>         Environment: Java: JDK 11 (Adoptium Temurin)
> OS: Windows 10
>            Reporter: Raymond
>            Priority: Minor
>
> I created a custom dataformat and call it with the XML-IO DSL like this:
>     <unmarshal>
>       <custom ref="myCustomDataformat"/>
>     </unmarshal>
> I get the following error:
> org.apache.camel.xml.io.XmlPullParserException: Unexpected element '{}custom'
> According to the XSD I would expect the custom element to be available
> [https://camel.apache.org/schema/spring/camel-spring-3.14.3.xsd]
> Also in Camel in Action2 (page 340) there is an example of this.
>  
> I load the XML with the "xml-io" library and "dataformat" is also on the 
> classpath.
> On the documentation page:
> [https://camel.apache.org/components/3.14.x/dataformats/index.html]
> The 'custom' dataformat isn't listed however and there is no documentation of 
> it. Is it still supported?
> Complete stacktrace:
> org.apache.camel.xml.io.XmlPullParserException: Unexpected element '{}custom'
>         at 
> org.apache.camel.xml.in.BaseParser.handleUnexpectedElement(BaseParser.java:187)
>         at org.apache.camel.xml.in.BaseParser.doParse(BaseParser.java:107)
>         at 
> org.apache.camel.xml.in.ModelParser.doParseUnmarshalDefinition(ModelParser.java:1449)
>         at 
> org.apache.camel.xml.in.ModelParser.doParseProcessorDefinitionRef(ModelParser.java:3212)
>         at 
> org.apache.camel.xml.in.ModelParser.lambda$outputDefinitionElementHandler$4(ModelParser.java:132)
>         at 
> org.apache.camel.xml.in.ModelParser.lambda$doParseRouteDefinition$71(ModelParser.java:1031)
>         at org.apache.camel.xml.in.BaseParser.doParse(BaseParser.java:106)
>         at 
> org.apache.camel.xml.in.ModelParser.doParseRouteDefinition(ModelParser.java:1005)
>         at 
> org.apache.camel.xml.in.ModelParser.parseSingleRoutesDefinition(ModelParser.java:1185)
>         at 
> org.apache.camel.xml.in.ModelParser.parseRoutesDefinition(ModelParser.java:1178)
>         at 
> org.apache.camel.dsl.xml.io.XmlRoutesBuilderLoader$1.configure(XmlRoutesBuilderLoader.java:78)
>         at 
> org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:607)
>         at 
> org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:553)
>         at 
> org.apache.camel.builder.RouteBuilder.updateRoutesToCamelContext(RouteBuilder.java:515)
>         at 
> org.apache.camel.spi.RoutesLoader.updateRoutes(RoutesLoader.java:105)
>         at 
> org.apache.camel.spi.RoutesLoader.updateRoutes(RoutesLoader.java:87)



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to