简体   繁体   English

使用属性迭代调解人表达式

[英]Iterate mediator-expression using property

I want to use iterator mediator by passing property as Xpath in expression. 我想通过在表达式中将属性作为Xpath传递来使用迭代器介体。 is that possible in wso2 esb 在wso2 esb中有可能吗

<property name="listXPath" value="//records/record"></property>
<iterate continueParent="true" expression="get-property('listXPath')" id="EventListId" sequential="true">
  <target>
    <sequence>
      <log>
        <property name="inside Iterator for Each List" expression="$body"></property>
      </log>
    </sequence>
  </target>
</iterate>

i want the result as iterator should accept property as a expression parameter 我希望结果作为迭代器应接受属性作为表达式参数

Guess this would not work. 猜猜这行不通。 But You can try to use Sequence template and pass your Xpath as a param to a call-template mediator. 但是您可以尝试使用Sequence模板,并将Xpath作为参数传递给调用模板介体。

You can set XPath for expression in iterate mediator. 您可以在迭代介体中设置用于表达的XPath。 WSO2 EI documentation [1] explains how to achieve it. WSO2 EI文档[1]解释了如何实现。 If you scroll down the documentation you will find an example in which they have used XPath in expression of iterate mediator. 如果向下滚动文档,您将找到一个示例,其中他们在迭代中介器的表达式中使用了XPath。

If you specifically want to have a property because there is a change in the body. 如果您特别想拥有一个属性,因为身体有所变化。 You can preserve the body on which you want to iterate in a property and apply the value of that property to body right before the iterate mediator and then directly use XPath to iterate the body. 您可以在属性中保留要在其上进行迭代的主体,并在迭代中介器之前将该​​属性的值应用于主体,然后直接使用XPath来迭代主体。

[1] https://docs.wso2.com/display/EI600/Iterate+Mediator [1] https://docs.wso2.com/display/EI600/Iterate+Mediator

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM