XmlFormat  
Description
Escapes special XML characters in a string, so that the string is safe to use with XML.
 
Returns
A copy of string that is safe to use with XML.
 
Category
Extensibility functions, String functions, XML functions
 
Function syntax
XmlFormat(string)
 
See also
cfxml, IsXmlDoc, XmlChildPos, XmlChildPos, XmlNew, XmlParse, XmlSearch, XmlTransform
 
History
ColdFusion MX: Added this function.
 
Parameters
 
Parameter      Description
string A string or a variable that contains one
 
Usage
The characters that this function escapes include the following:
  • Greater than symbol (>)
  • Less than symbol (<)
  • Single quotation mark (')
  • Double quotation mark (")
  • Ampersand symbol (&)
 
Example
<h3>XMLFormat</h3>
<p>This example shows how XMLFormat is used to escape special 
XML characters and make the use of XML with ColdFusion easy.</p>
<XMP>
<?xml version = "1.0"?> 
<cfoutput>
<someXML>
   <someElement someAttribute = "#XMLFormat("'a quoted value'")#> 
      #XMLFormat(   "Body of element to be passed here.")#
   </someElement>
</someXML>   
</cfoutput>
</XMP>
string  
A string or a variable that contains one