【发布时间】:2019-10-02 10:00:41
【问题描述】:
我已经输入了这样的 XML -
<parent>
<child type="reference">
<grandChild name="aaa" action="None">
<Attribute name="xxx">1</Attribute>
<grandChild name="bbb" action="None">
<Attribute name="xxx">1</Attribute>
</grandChild>
<grandChild name="aaa" action="None">
<Attribute name="xxx">2</Attribute>
</grandChild>
</grandChild>
<grandChild name="ddd" action="None">
<Attribute name="xxx">1</Attribute>
<grandChild name="aaa" action="None">
<Attribute name="xxx">3</Attribute>
</grandChild>
</grandChild>
</child>
</parent>
我想提取所有按名称聚合的 grandChild 节点。例如,如果我想提取 payload.parent.child.*grandChild filter($.@name == 'aaa') 我应该得到包含 3 个 grandChild 节点的数组列表。有没有办法做到这一点?
感谢您的帮助。
输出 -
<grandChilds>
<grandChild name="aaa" action="None">
<Attribute name="xxx">1</Attribute>
</grandChild>
<grandChild name="aaa" action="None">
<Attribute name="xxx">2</Attribute>
</grandChild>
<grandChild name="aaa" action="None">
<Attribute name="xxx">3</Attribute>
</grandChild>
</grandChilds>
【问题讨论】:
标签: mule anypoint-studio dataweave mule4