User Guide

916 Chapter 3: ColdFusion Functions
XmlNew
Description
Creates an XML document object.
Returns
An empty XML document object.
Category
XML functions
Function syntax
XmlNew([caseSensitive])
See also
cfxml
, IsXmlDoc, ToString, XmlFormat, XmlParse, XmlValidate; Chapter 35, “Using XML
and WDDX” in ColdFusion MX Developers Guide
History
ColdFusion MX: Added this function.
Parameters
Usage
An XML document object is represented in ColdFusion as a structure.
The
caseSensitive parameter value determines whether identifiers whose characters are of
varying case, but are otherwise the same, refer to different components; for example:
If True, the element or attribute names “name and “NAME” refer to different elements or
attributes.
If False, these names refer to the same elements or attributes.
If your XML object is case sensitive, you cannot use dot notation to reference an element or
attribute name. Use the name in associative array (bracket) notation, or a reference that does not
use the case-sensitive name (such as xmlChildren[1]) instead. In the following code, the first line
will work with a case-sensitive XML object. The second and third lines cause errors:
MyDoc.xmlRoot.XmlAttributes["Version"] = "12b";
MyDoc.xmlRoot.XmlAttributes.Version = "12b";
MyDoc.MyRoot.XmlAttributes["Version"] = "12b";
To convert an XML document object into a string, use the ToString function.
Parameter Description
caseSensitive Determines how ColdFusion processes the case of XML document object
component identifiers:
True: maintains case
False: ColdFusion ignores case. Default.