373.4. Spring 或 Blueprint DSL 的基本用法


在 & lt;dataFormats > 块中,只需要使用唯一 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 /> 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 来指代适当的 Schema 位置。请记住,这种数据格式可从 Camel 2.10 开始获得,因此只有该版本中的模式才会包含这些新的 XML 元素和属性。

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

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat