VKP
VKP

Reputation: 658

How i can remove entire tag from XML using Dataweave?

How i can remove entire tag from my input payload xml . In this payload i need to remove entire borrower tag .

Payload

<users>
<user username="Julian" password="1234"/>
<borrower username="Mariano" password="4321"/>
</users>

Expected Output is

<users>
<user username="Julian" password="1234"/>
</users>

Upvotes: 0

Views: 1089

Answers (1)

olamiral
olamiral

Reputation: 1296

You can try the following DataWeave expression:

%dw 2.0
output application/xml
---
{
    "users": payload.users - "borrower"
}

Upvotes: 2

Related Questions