Escapes XML special characters in a string, so that the string is safe to use with XML.

XMLFormat(String [, escapeChars]) → returns String

Discouraged: Adobe recommends using encodeForXML instead of XMLFormat.

XMLFormat Argument Reference


The string to escape


When true escapes restricted characters according to the W3C XML standard.

Examples sample code invoking the XMLFormat function

Basic XMLFormat() usage

In this example we demonstrate passing the invalid characters < and & into the XMLFormat() function to make them XML safe.

writeOutput( XMLFormat( '<node>Good &amp; Juicy</node>') );

Expected Result: &lt;node&gt;Good &amp;amp; Juicy&lt;/node&gt;

Fork me on GitHub