Loading

Escape All the XML Special Characters in Dataweave

Julkaisupäivä: Jul 25, 2025
Tehtävä

GOAL

This article will help in escaping all the special characters in XML.
Below is the list of all the escape characters that we have in XML:

"   "
'   '
<   &lt;
>   &gt;
&   &amp;
 
Vaiheet
Use the "escapeGT=true" header directive to achieve this goal.

Input payload
{
"Description": " < > & ' \""
}

Dataweave script
%dw 2.0
output application/xml escapeGT=true
---
payload

Output payload
<?xml version='1.0' encoding='UTF-8'?>
<Description> &lt; &gt; &amp; &apos; &quot;</Description>
 

 

Knowledge-artikkelin numero

001116766

 
Ladataan
Salesforce Help | Article