373.4. 使用 Spring 或 Blueprint DSL 的基本用法


在 &lt ;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>
Copy to Clipboard Toggle word wrap

然后,您只是引用 < marshal /> 和 < unmarshal /&gt; DSLs 中的数据格式对象:

<route>
    <from uri="direct:marshal"/>
    <marshal ref="xmljson"/>
    <to uri="mock:json" />
</route>

<route>
    <from uri="direct:unmarshalWithOptions"/>
    <unmarshal ref="xmljsonWithOptions"/>
    <to uri="mock:xmlWithOptions"/>
</route>
Copy to Clipboard Toggle word wrap

为这个组件启用 XML DSL 自动完成功能非常简单:根据您是否使用 SpringBlueprint DSL,只需引用相应的 架构位置。请记住,这个数据格式可从 Camel 2.10 开始获得,因此只有该版本的模式会包括这些新的 XML 元素和属性。

具有 Blueprint 的语法与 Spring DSL 的语法相同。只需确保使用正确的命名空间和 schemaLocations。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat