Loading

Escape All the XML Special Characters in Dataweave

Date de publication: Jul 25, 2025
Tâche

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;
 
Étapes
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>
 

 

Numéro d’article de la base de connaissances

001116766

 
Chargement
Salesforce Help | Article