我有一个XML,我想在Dataweave中检查XML中是否存在re.setIsActive(tt.isActive());
re.setCbDate(LocalDate.parse(tt.getCobDate()));
re.setCreatedDate(LocalDate.now());
标记,该怎么做?
<custom-attribute attribute-id="sscAccountid">0011x0000152nlyAAA</custom-attribute>
答案 0 :(得分:0)
我了解您想确认具有示例结构的XML有效负载是否具有order.custom-attributes.custom-attribute元素,且其属性attribute-id等于“ sscAccountid”。
%dw 2.0
output application/json
fun hasAccountId(x) =sizeOf(x.order.'custom-attributes' filterObject ($.@'attribute-id' == "sscAccountid") ) > 0
---
hasAccountId(payload)
输入XML的输出:
true