Exam4Training

What DataWeave expression transforms the example XML input to the CSV output?

What DataWeave expression transforms the example XML input to the CSV output?

A)

B)

C)

D)

A . Option A
B. Option B
C. Option C
D. Option D

Answer: A

Explanation:

Correct answer is as below. Attributes in the incoming xml payload are always accessed using @.Similarly *item is required as we have multiple items in the request %dw 2.0

output application/csv



payload.sale.*item map ((value, index) -> {

index: index,

sale: value.@saleId,

itemName: value.desc,

itemPrice: (value.quantity) * (value.price),

item: value.@itemId

} )

Exit mobile version