使用xpath进行拆分时,骆驼拆分器实际上对XML文档有什么作用? [英] What does Camel Splitter actually do with XML Document when splitting with xpath?

查看:85
本文介绍了使用xpath进行拆分时,骆驼拆分器实际上对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.

但是,我接下来要做的是订单行的元素,这是我想要的,但是在转换它时,我需要来自order元素的信息-但是如果我尝试在拆分后通过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进行拆分时,骆驼拆分器实际上对XML文档有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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