373.4. 使用 Spring 或 Blueprint DSL 的基本用法
在 < ;dataFormats&
gt; 块中,只需使用唯一 ID 配置 xmljson
元素:
<dataFormats> <xmljson id="xmljson"/> <xmljson id="xmljsonWithOptions" forceTopLevelObject="true" trimSpaces="true" rootName="newRoot" skipNamespaces="true" removeNamespacePrefixes="true" expandableProperties="d e"/> </dataFormats>
<dataFormats>
<xmljson id="xmljson"/>
<xmljson id="xmljsonWithOptions" forceTopLevelObject="true" trimSpaces="true" rootName="newRoot" skipNamespaces="true"
removeNamespacePrefixes="true" expandableProperties="d e"/>
</dataFormats>
然后,您只是引用 < marshal /> 和 <
unmarshal />
; DSLs 中的数据格式对象:
为这个组件启用 XML DSL 自动完成功能非常简单:根据您是否使用 Spring 或 Blueprint DSL,只需引用相应的 架构位置。请记住,这个数据格式可从 Camel 2.10 开始获得,因此只有该版本的模式会包括这些新的 XML 元素和属性。
具有 Blueprint 的语法与 Spring DSL 的语法相同。只需确保使用正确的命名空间和 schemaLocations。