XMLFormat
Formats a string so that special XML characters can be used as text in XML
Method Signature
XMLFormat(string=[string], escapeChars=[boolean])
Arguments
Argument
Type
Required
Description
Default
string
string
true
The string to format
escapeChars
boolean
false
whether to escape additional characters restricted as per XML standards. For details, see http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-RestrictedChar.
false
Examples
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 & Juicy</node>" ) );
Result: <node>Good & Juicy</node>
Additional Examples
string = "I like peanut butter & jelly.";
dump( XmlFormat( string ) );
// I like peanut butter & jelly.
Related
Last updated
Was this helpful?