【发布时间】:2017-02-20 16:29:47
【问题描述】:
Dataweave 的输入
<root>
<client>
<name>abc<name>
<status>success</status>
</client>
<client>
<name>def<name>
<status>success</status>
</client>
<client>
<name>ghi<name>
<status>success</status>
</client>
<client>
<name>jkl<name>
<status>failed</status>
</client>
<client>
<name>mno<name>
<status>success</status>
</client>
</root>
预期输出:
<root>
<clients>
<name>abc<name>
<name>def<name>
<name>ghi<name>
........
</clients>
<status>false</status> // if all status are success then true otherwise false
</root>
在这里,我可以遍历每个 xml 标记并使用 dataweave 映射客户端标记下的名称值。但我必须为所有状态映射单个输出。 即当一切都成功时,我的状态将为 true ,如果任何一个状态为失败,我的状态将为 false。 为此,我们必须编写一个函数,该函数将遍历每个 xml 标记,并且必须根据条件返回输出 trur 或 false。
谢谢,
【问题讨论】: