Input XML:
<Orders>
<Order>
<sample id="a">23435</sample>
.
.
.
<sample id="x">D123</sample>
.
.
<sample id="y">5346</sample>
<sample id="z"></sample>
.
.
</Order>
<Order>
<sample id="a">23435</sample>
.
.
.
<sample id="x">D345</sample>
.
.
<sample id="y">5346</sample>
<sample id="z">D217</sample>
.
.
</Order>
<Order>
<sample id="a">23435</sample>
.
.
.
<sample id="x">D1235</sample>
.
.
<sample id="y">5346</sample>
<sample id="z"></sample>
.
.
</Order>
Requirement:
If 'sample' element with attribute='z' has no value then I need to map 'sample' element with attribute 'x' to 'ProId'; else if it has value, then I should not pass any value to 'ProFeed' map. (For each 'Order' element I need to create one 'ProFeed' map)
Output:
[ProFeed={ProId="",Lang="eng",CatId="AU"},ProFeed={ProId="",Lang="eng",CatId="AU"},ProFeed={ProId="",Lang="eng",CatId="AU"}]
DataWeave config:
%input application/xml
%output application/java
.(some configuration code)
.
.
Please help me out in the configuration of DataWeave component.