使用 xpath 拆分时,Camel Splitter 实际上对 XML 文档做了什么? [英] What does Camel Splitter actually do with XML Document when splitting with xpath?

查看:23
本文介绍了使用 xpath 拆分时,Camel Splitter 实际上对 XML 文档做了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含订单和多行的文档.我需要将订单分成几行,因此我将骆驼拆分器设置为 xpath,并将订单行作为其值.这工作正常.

I have a document with an order and a number of lines. I need to break the order into lines so I have a camel splitter set to xpath with the order line as it's value. This works fine.

但是,我要前进的是订单行的一个元素,这正是我想要的,但是在转换它时,我需要来自订单元素的信息 - 但是如果我尝试在拆分后通过 xpath 获取父元素,这不起作用.

However, what I get going forward is an element for the order line, which is what I want, but when converting it I need information from the order element - but if I try to get the parent element via xpath following the split, this doesn't work.

Camel 是创建 xpath 表达式返回的节点的副本,还是返回父文档中的节点列表?如果是前者,我可以做后者吗?如果是后者,有什么想法为什么../*"表达式什么都不返回?

Does Camel create copies of the nodes returned by the xpath expression, or return a list of nodes within the parent document? If the former, can I make it the latter? If the latter, any ideas why a "../*" expression would return nothing?

谢谢!

胶带.

推荐答案

查看使用 Tokenizer 时可用的拆分选项:http://camel.apache.org/splitter.html

Look at the split options that are available when using a Tokenizer: http://camel.apache.org/splitter.html

您有四种不同的模式(i、w、u、t),w"一种是保留祖先上下文.在这种情况下,父节点(=您显然需要的东西)将在每个子消息中重复

You have four different modes (i, w, u, t) and the 'w' one is keeping the ancestor context. In such case, the parent node (=the thing you apparently need) will be repeated in each sub-message

默认:

<m:order><id>123</id><date>2014-02-25</date></m:order>

'w' 模式:

<m:orders>
  <m:order><id>123</id><date>2014-02-25</date>...</m:order>
</m:orders>

这篇关于使用 xpath 拆分时,Camel Splitter 实际上对 XML 文档做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆