My XML Structure looks like below:-
<element>
<note nom="Rock" >Roll</note>
<note nom="Bands" >
<note nom="Unit" >jayz<note>
<note nom="Unit" >eminem<note>
<note nom="Unit" >drake<note>
</note>
</element>
After transformation I am only able to retain the last unit value Drake. The first two unit values are overridden during transformation.
Need help with the dataweave transformation (XML to JAVA)
Yes currently the attributes are being lost, though you can map them by hand.
payload.notes.*note map ((note, index) -> {
(note: note) if note != null,
(note.@)
})
Taking this xml as input
<notes>
<note nom="Rock" >Roll</note>
<note nom="Bands"/>
<note nom="Unit" >jayz</note>
<note nom="Unit" >eminem</note>
<note nom="Unit" >drake</note>
</notes>
Having said this there is going to be a new writer flag on next release to make json writer and java writer persist the attributes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With