encodeForXML

Encodes a string for XML.

encodeForXML(Inputstring , [canonicalize]); → returns Encoded XML string.

Argument Reference for the encodeForXML function

inputString

Required: Yes
The string to encode.

canonicalize

Required: No
If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded. The default value for canonicalize is false. When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed. To use any other combinations you should canonicalize using canonicalize method and then do encoding.

Examples sample code invoking the encodeForXML function


Tag Syntax

<cfif not isDefined ('form.url')> 
 <cfset form.url = 'www.adobe.com'>  
 </cfif> 
 <cfform action='#cgi.SCRIPT_NAME#' method='post'> 
 <cfinput name='url' type='text' value='#form.url#'> 
 <cfinput name='submit' type='submit' value='Show link to this URL!!!'> 
 </cfform> 
 <hr /> 
 <cfoutput >  
 <b>LINK to URL:</b> 
 <a target='_blank' href='http://#encodeForURL(form.url)#'>#encodeForURL(form.url)#</a> 
 </cfoutput> 

Fork me on GitHub