【问题标题】:spring-xd work with xml payloadspring-xd 使用 xml 有效负载
【发布时间】:2015-03-17 22:15:05
【问题描述】:

是否可以在 spring-XD 运行时中使用 XML 有效负载?我有以下我正在尝试执行的流:

stream create --name testingXML --definition "file --dir=/tmp/sample.xml 
              --outputType=application/xml | splitter --expression=//item | log"

我的目标是根据给定的 XPATH 表达式进行拆分(由 Spring 集成支持)。

【问题讨论】:

    标签: xml spring xpath spring-integration spring-xd


    【解决方案1】:

    当使用“简单”拆分器(而不是 XPath 拆分器 - XD 目前没有 XPathSplitter 模块)时,您需要在表达式中使用 #xpath function

    【讨论】:

    • 感谢您的及时回复!!!为了完整起见,让我添加以下几点。 1:我必须将 spring-integration-xml 和 spring-xml jar 添加到类路径中,这是有效的命令:stream create --name testingXML2 --definition "file --dir=/opt/tuto/xd/ --outputType=text/plain | splitter --expression=\"#xpath(payload, '//item','document_list')\" | log" --deploy
    【解决方案2】:

    XD 目前也不支持 --outputType=application/xml 。这意味着不会通过 JAXB 等将有效负载自动转换为 XML。但如果您的生产模块已经发出 XML,则不需要它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-06
      • 1970-01-01
      • 1970-01-01
      • 2017-05-04
      • 2017-02-08
      • 1970-01-01
      相关资源
      最近更新 更多