Loading

Escape All the XML Special Characters in Dataweave

Дата публикации: Jul 25, 2025
Задача

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;
 
Действия
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>
 

 

Номер статьи базы знаний

001116766

 
Загрузка
Salesforce Help | Article