3
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) 
leo_roar_001
  • 181
  • 1
  • 10

1 Answers1

1

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

machaval
  • 4,969
  • 14
  • 20