Skip to content

escapeXML

escapeXML(text) → string · XML

Escapes special XML characters (<, >, &, ", ') in text without using CDATA. See Chapter 22.

  • text (required): string to escape
bash
echo '{"text": "price < 100 & qty > 0"}' | utlx -e 'escapeXML($input.text)'
# "price &lt; 100 &amp; qty &gt; 0"
utlx
{
  safeText: escapeXML($input.userInput)
}

Released under AGPL-3.0.